mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-04 12:03:41 +02:00
internal/server/ship_processor.go: updateAbiFromAction() should not hex decode abi as it is in binary format
only when encoding the action to json it is in hex, but from ship = always binary
This commit is contained in:
parent
1a782604d3
commit
ef6329d1b7
1 changed files with 5 additions and 11 deletions
|
|
@ -2,7 +2,6 @@ package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
|
||||||
|
|
||||||
"github.com/eosswedenorg/thalos/api/message"
|
"github.com/eosswedenorg/thalos/api/message"
|
||||||
"github.com/eosswedenorg/thalos/internal/abi"
|
"github.com/eosswedenorg/thalos/internal/abi"
|
||||||
|
|
@ -78,24 +77,19 @@ func (processor *ShipProcessor) initHandler(abi *chain.Abi) {
|
||||||
func (processor *ShipProcessor) updateAbiFromAction(act *chain.Action) error {
|
func (processor *ShipProcessor) updateAbiFromAction(act *chain.Action) error {
|
||||||
set_abi := struct {
|
set_abi := struct {
|
||||||
Account chain.Name
|
Account chain.Name
|
||||||
Abi string
|
Abi chain.Bytes
|
||||||
}{}
|
}{}
|
||||||
|
|
||||||
if err := act.DecodeInto(&set_abi); err != nil {
|
if err := act.DecodeInto(&set_abi); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
binary_abi, err := hex.DecodeString(set_abi.Abi)
|
abi := chain.Abi{}
|
||||||
if err != nil {
|
decoder := chain.NewDecoder(bytes.NewReader(set_abi.Abi))
|
||||||
|
if err := decoder.Decode(&abi); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
return processor.abi.SetAbi(set_abi.Account, &abi)
|
||||||
contract_abi := chain.Abi{}
|
|
||||||
err = chain.NewDecoder(bytes.NewReader(binary_abi)).Decode(&contract_abi)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return processor.abi.SetAbi(set_abi.Account, &contract_abi)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the current block.
|
// Get the current block.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue