1
0
Fork 0
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:
Henrik Hautakoski 2024-07-03 18:01:31 +02:00
parent 1a782604d3
commit ef6329d1b7

View file

@ -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.