diff --git a/aeternity/helpers.go b/aeternity/helpers.go index 85de735e..d2bd2faa 100644 --- a/aeternity/helpers.go +++ b/aeternity/helpers.go @@ -114,7 +114,7 @@ func SpendTxStr(sender, recipient string, amount, fee utils.BigInt, message stri } // BroadcastTransaction recalculates the transaction hash and sends the transaction to the node. -func BroadcastTransaction(nodeClient *apiclient.Node, txSignedBase64 string) (err error) { +func (ae *Ae) BroadcastTransaction(txSignedBase64 string) (err error) { // Get back to RLP to calculate txhash txRLP, _ := Decode(txSignedBase64) @@ -124,7 +124,7 @@ func BroadcastTransaction(nodeClient *apiclient.Node, txSignedBase64 string) (er signedEncodedTxHash := Encode(PrefixTransactionHash, rlpTxHashRaw) // send it to the network - err = postTransaction(nodeClient, txSignedBase64, signedEncodedTxHash) + err = postTransaction(ae.Node, txSignedBase64, signedEncodedTxHash) return } diff --git a/cmd/chain.go b/cmd/chain.go index 8352ecae..e66c7b3f 100644 --- a/cmd/chain.go +++ b/cmd/chain.go @@ -122,7 +122,7 @@ func broadcastFunc(cmd *cobra.Command, args []string) (err error) { } aeCli := NewAeCli() - err = aeternity.BroadcastTransaction(aeCli.Node, txSignedBase64) + err = aeCli.BroadcastTransaction(txSignedBase64) if err != nil { errFinal := fmt.Errorf("Error while broadcasting transaction: %v", err) return errFinal diff --git a/integration_test/integration_test.go b/integration_test/integration_test.go index 61e1a925..c5789d78 100644 --- a/integration_test/integration_test.go +++ b/integration_test/integration_test.go @@ -58,7 +58,7 @@ func TestSpendTxWithNode(t *testing.T) { fmt.Println(signedBase64TxMsg) // send the signed transaction to the node - err = aeternity.BroadcastTransaction(aeCli.Node, signedBase64TxMsg) + err = aeCli.BroadcastTransaction(signedBase64TxMsg) if err != nil { t.Fatalf("Error while broadcasting transaction: %v", err) } @@ -120,7 +120,7 @@ func TestSpendTxLargeWithNode(t *testing.T) { fmt.Println(signedBase64TxMsg) // send the signed transaction to the node - err = aeternity.BroadcastTransaction(aeCli.Node, signedBase64TxMsg) + err = aeCli.BroadcastTransaction(signedBase64TxMsg) if err != nil { t.Fatalf("Error while broadcasting transaction: %v", err) }