Add node ID field to file structure

This commit is contained in:
Kleissner
2021-09-28 19:55:30 +02:00
parent 608dbf6f47
commit 2c20fa950d
6 changed files with 22 additions and 10 deletions

View File

@@ -348,7 +348,7 @@ func UserBlockchainAddFiles(files []BlockRecordFile) (newHeight, newVersion uint
// If there is a corruption in the blockchain it will stop reading but return the files parsed so far.
func UserBlockchainListFiles() (files []BlockRecordFile, status int) {
status = blockchainIterate(func(block *Block) (statusI int) {
filesMore, err := decodeBlockRecordFiles(block.RecordsRaw)
filesMore, err := decodeBlockRecordFiles(block.RecordsRaw, block.NodeID)
if err != nil {
return BlockchainStatusCorruptBlockRecord
}
@@ -455,7 +455,7 @@ func UserBlockchainDeleteFiles(IDs []uuid.UUID) (newHeight, newVersion uint64, s
return 0 // no action on record
}
filesDecoded, err := decodeBlockRecordFiles([]BlockRecordRaw{*record})
filesDecoded, err := decodeBlockRecordFiles([]BlockRecordRaw{*record}, nil)
if err != nil || len(filesDecoded) != 1 {
return 3 // error blockchain corrupt
}