OSDN Git Service

fix logic bug on broadcast tx
authorpaladz <453256728@qq.com>
Thu, 28 Sep 2017 08:05:49 +0000 (16:05 +0800)
committerpaladz <453256728@qq.com>
Thu, 28 Sep 2017 08:05:49 +0000 (16:05 +0800)
blockchain/reactor.go
protocol/mempool.go

index fb1d08e..3121950 100644 (file)
@@ -436,7 +436,7 @@ func (bcR *BlockchainReactor) BroadcastStatusRequest() error {
 
 func (bcR *BlockchainReactor) BroadcastTransaction(tx *legacy.Tx) error {
        rawTx, err := tx.TxData.MarshalText()
-       if err == nil {
+       if err != nil {
                return err
        }
        bcR.Switch.Broadcast(BlockchainChannel, struct{ BlockchainMessage }{&bcTransactionMessage{rawTx}})
index 5497a82..814da56 100644 (file)
@@ -79,7 +79,7 @@ func (mp *TxPool) GetErrCache(txHash *bc.Hash) error {
        defer mp.mtx.Unlock()
 
        v, ok := mp.errCache.Get(txHash)
-       if ok {
+       if !ok {
                return nil
        }
        return v.(error)