forked from TrueCloudLab/neoneo-go
core: fix bug in nep5 notifications handling
Native contracts deployment creates `Transfer` notifications and adds them into interop context. However, these notifications were not stored for two reasons: 1. typo in `Transfer` (so these notifications were not recognised during processing of the invocation tx in (*Blockchain).storeBlock(...) method) 2. these notifications have `from` adress setted to null, so conversion to []byte fails. Same thing could happen with `to`. Related C# issue: https://github.com/neo-project/neo/issues/1646 For now, made both `transfer` and `Transfer` valid.
This commit is contained in:
parent
45b8bdb51c
commit
4ebac5a069
1 changed files with 17 additions and 7 deletions
|
@ -651,16 +651,26 @@ func (bc *Blockchain) storeBlock(block *block.Block) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
op, ok := arr[0].Value().([]byte)
|
op, ok := arr[0].Value().([]byte)
|
||||||
if !ok || string(op) != "transfer" {
|
if !ok || (string(op) != "transfer" && string(op) != "Transfer") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
from, ok := arr[1].Value().([]byte)
|
var from []byte
|
||||||
if !ok {
|
fromValue := arr[1].Value()
|
||||||
continue
|
// we don't have `from` set when we are minting tokens
|
||||||
|
if fromValue != nil {
|
||||||
|
from, ok = fromValue.([]byte)
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
to, ok := arr[2].Value().([]byte)
|
var to []byte
|
||||||
if !ok {
|
toValue := arr[2].Value()
|
||||||
continue
|
// we don't have `to` set when we are burning tokens
|
||||||
|
if toValue != nil {
|
||||||
|
to, ok = toValue.([]byte)
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
amount, ok := arr[3].Value().(*big.Int)
|
amount, ok := arr[3].Value().(*big.Int)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in a new issue