Skip to content

Commit

Permalink
rpcserver: Fix sendrawtransaction error code.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnldd authored and davecgh committed Nov 5, 2018
1 parent 5f80817 commit 13b69e2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4998,16 +4998,14 @@ func handleSendRawTransaction(s *rpcServer, cmd interface{}, closeChan <-chan st
// go wrong, so log it as an actual error. In both cases, a
// JSON-RPC error is returned to the client with the
// deserialization error code (to match bitcoind behavior).
if _, ok := err.(mempool.RuleError); ok {
if rErr, ok := err.(mempool.RuleError); ok {
err = fmt.Errorf("Rejected transaction %v: %v", tx.Hash(),
err)
rpcsLog.Debugf("%v", err)
txRuleErr, ok := err.(mempool.TxRuleError)
if ok {
if txRuleErr.RejectCode == wire.RejectDuplicate {
// return a dublicate tx error
return nil, rpcDuplicateTxError("%v", err)
}
txRuleErr, ok := rErr.Err.(mempool.TxRuleError)
if ok && txRuleErr.RejectCode == wire.RejectDuplicate {
// return a duplicate tx error
return nil, rpcDuplicateTxError("%v", err)
}

// return a generic rule error
Expand Down

0 comments on commit 13b69e2

Please sign in to comment.