forked from TrueCloudLab/neoneo-go
vm: serialize +
rune as \u002B
for byte-contained stackitems
This commit fixes the following Go vs C# state diff: block 74613: value mismatch for key EwAAAHN0cmVhbXMvDg==: eyJpZCI6MTQsInN0YXJ0IjoxNjIyNTAwMjAwMDAwLCJzdG9wIjoxNjIyNTAyMDAwMDAwLCJkZXBvc2l0IjoxMDAwMDAwMDAsInJlbWFpbmluZyI6MTAwMDAwMDAwLCJzZW5kZXIiOiJmeEY4RDl2ZFU3K0gwcDV3NTlyWllMNytNSlE9IiwicmVjaXBpZW50IjoiSVV6c3pveFV0S1NGVnlZRGczSmdTQTFlbTFNPSJ9 vs eyJpZCI6MTQsInN0YXJ0IjoxNjIyNTAwMjAwMDAwLCJzdG9wIjoxNjIyNTAyMDAwMDAwLCJkZXBvc2l0IjoxMDAwMDAwMDAsInJlbWFpbmluZyI6MTAwMDAwMDAwLCJzZW5kZXIiOiJmeEY4RDl2ZFU3XHUwMDJCSDBwNXc1OXJaWUw3XHUwMDJCTUpRPSIsInJlY2lwaWVudCI6IklVenN6b3hVdEtTRlZ5WURnM0pnU0ExZW0xTT0ifQ== I.e.: ``` {"id":14,"start":1622500200000,"stop":1622502000000,"deposit":100000000,"remaining":100000000,"sender":"fxF8D9vdU7+H0p5w59rZYL7+MJQ=","recipient":"IUzszoxUtKSFVyYDg3JgSA1em1M="} ``` vs ``` {"id":14,"start":1622500200000,"stop":1622502000000,"deposit":100000000,"remaining":100000000,"sender":"fxF8D9vdU7\u002BH0p5w59rZYL7\u002BMJQ=","recipient":"IUzszoxUtKSFVyYDg3JgSA1em1M="} ```
This commit is contained in:
parent
fd36f2568e
commit
f95bdd9cb5
1 changed files with 4 additions and 0 deletions
|
@ -111,6 +111,10 @@ func writeJSONString(w *io.BinWriter, it Item) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data, _ := json.Marshal(s) // error never occurs because `ToString` checks for validity
|
data, _ := json.Marshal(s) // error never occurs because `ToString` checks for validity
|
||||||
|
|
||||||
|
// ref https://github.com/neo-project/neo-modules/issues/375 and https://github.com/dotnet/runtime/issues/35281
|
||||||
|
data = bytes.Replace(data, []byte{'+'}, []byte("\\u002B"), -1)
|
||||||
|
|
||||||
w.WriteBytes(data)
|
w.WriteBytes(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue