mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 01:41:48 +00:00
core: add NewTransactionFromBytes method to Transaction
Added `NewTransactionFromBytes(b []byte)` method to transaction.Transaction in order to avoid code duplication.
This commit is contained in:
parent
5a22651e36
commit
d1f92a585b
4 changed files with 18 additions and 12 deletions
|
@ -279,11 +279,9 @@ func (c *Client) GetRawTransaction(hash util.Uint256) (*transaction.Transaction,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r := io.NewBinReaderFromBuf(txBytes)
|
||||
tx := new(transaction.Transaction)
|
||||
tx.DecodeBinary(r)
|
||||
if r.Err != nil {
|
||||
return nil, r.Err
|
||||
tx, err := transaction.NewTransactionFromBytes(txBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return tx, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue