You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.
// Determine whether the leading bytes contain a checksum. A proper checksum// will be 67 bytes (quote, 64 byte checksum, quote, newline). A manual// checksum will be the characters "manual\n" (9 characters). If neither// decode correctly, it is assumed that there is no checksum at all.varchecksum crypto.Hasherr=json.Unmarshal(remainingBytes[:67], &checksum)
iferr==nil&&checksum==crypto.HashBytes(remainingBytes[68:]) {
// Checksum is proper, and matches the data. Update the data portion to// exclude the checksum.remainingBytes=remainingBytes[68:]
} else {
// Cryptographic checksum failed, try interpreting a manual checksum.varmanualChecksumstringerr:=json.Unmarshal(remainingBytes[:8], &manualChecksum) // Line 70iferr==nil&&manualChecksum=="manual" {
// Manual checksum is proper. Update the remaining data to exclude// the manual checksum.remainingBytes=remainingBytes[9:] // Line 74
}
}
In line 70, it try to json.Unmarshal with remainingBytes[:8] which is only 7 bytes. json.Unmarshal([]byte("\"manual"), &manualChecksum) is always return an error (unexpected end of JSON input), it should be changed to remainingBytes[:9], and also, the remainingBytes[9:] in line 74 should be changed to remainingBytes[10:].
Stack Trace or error message
No
Expected Behavior
treat "manual" as a correct checksum
How to reproduce it (as minimally and precisely as possible)
run siad with miner module (siad -M gctwm)
modify third line of /miner/miner.json to "manual"
restart siad with miner module
it takes very long time to load miner module because latestChangeID from this file is ignored by siad.
Environment
Sia version: v1.3.3
OS: Debian 8.9 (it doesn't matter)
The text was updated successfully, but these errors were encountered:
wincss
added a commit
to wincss/Sia
that referenced
this issue
Jul 20, 2018
I modified some content in miner.json and changed checksum to manual
"Miner Settings"
"0.5.0"
"manual"
{
... content here ...
}
siad treat it as a wrong checksum and ignore the file content.
https://github.com/NebulousLabs/Sia/blob/master/persist/json.go#L70
In line 70, it try to
json.Unmarshal
withremainingBytes[:8]
which is only 7 bytes.json.Unmarshal([]byte("\"manual"), &manualChecksum)
is always return an error (unexpected end of JSON input
), it should be changed toremainingBytes[:9]
, and also, theremainingBytes[9:]
in line 74 should be changed toremainingBytes[10:]
.Stack Trace or error message
No
Expected Behavior
treat "manual" as a correct checksum
How to reproduce it (as minimally and precisely as possible)
Environment
The text was updated successfully, but these errors were encountered: