Skip to content

Commit

Permalink
refactor: NewContext does not need to return error after all. ErrWait…
Browse files Browse the repository at this point in the history
…Transaction type was too complicated for its usefulness
  • Loading branch information
randomshinichi committed Jan 21, 2020
1 parent 8cc0af8 commit a6b5cb1
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions aeternity/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,6 @@ type getTransactionByHashHeighter interface {
naet.GetHeighter
}

// ErrWaitTransaction is returned by WaitForTransactionForXBlocks() to let
// callers distinguish between network errors and transaction acceptance errors.
type ErrWaitTransaction struct {
NetworkErr bool
TransactionErr bool
Err error
}

func (b ErrWaitTransaction) Error() string {
var errType string
if b.TransactionErr {
errType = "TransactionErr"
} else {
errType = "NetworkErr"
}

return fmt.Sprintf("%s: %s", errType, b.Err.Error())
}

// SignBroadcast signs a transaction and broadcasts it to a node.
func SignBroadcast(tx transactions.Transaction, signingAccount *account.Account, n naet.PostTransactioner, networkID string) (txReceipt *TxReceipt, err error) {
signedTx, hash, signature, err := transactions.SignHashTx(signingAccount, tx, networkID)
Expand Down Expand Up @@ -133,7 +114,7 @@ func (t *TxReceipt) String() string {
return fmt.Sprintf("Mined: %v\nTx: %+v\nSigned: %s\nHash: %s\nSignature: %s\nBlockHeight: %d\nBlockHash: %s", t.Mined, *t.Tx, t.SignedTx, t.Hash, t.Signature, t.BlockHeight, t.BlockHash)
}

func NewTxReceipt(tx *transactions.Transaction, signedTx, hash, signature string) (txReceipt *TxReceipt) {
func NewTxReceipt(tx transactions.Transaction, signedTx, hash, signature string) (txReceipt *TxReceipt) {
txReceipt = &TxReceipt{
Tx: tx,
SignedTx: signedTx,
Expand Down

0 comments on commit a6b5cb1

Please sign in to comment.