1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-17 04:30:03 +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:
Henrik Hautakoski 2024-07-03 18:01:31 +02:00
parent 1a782604d3
commit ef6329d1b7

View file

@ -2,7 +2,6 @@ package server
import (
"bytes"
"encoding/hex"
"github.com/eosswedenorg/thalos/api/message"
"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 {
set_abi := struct {
Account chain.Name
Abi string
Abi chain.Bytes
}{}
if err := act.DecodeInto(&set_abi); err != nil {
return err
}
binary_abi, err := hex.DecodeString(set_abi.Abi)
if err != nil {
abi := chain.Abi{}
decoder := chain.NewDecoder(bytes.NewReader(set_abi.Abi))
if err := decoder.Decode(&abi); err != nil {
return err
}
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)
return processor.abi.SetAbi(set_abi.Account, &abi)
}
// Get the current block.