Fix fix -- ignore cb if mempool broadcastTx cb is nil

This commit is contained in:
Jae Kwon
2016-02-08 15:25:25 -08:00
parent 7613557528
commit a7523015f7
+6 -4
View File
@@ -84,10 +84,12 @@ func (mem *Mempool) CheckTx(tx types.Tx, cb func(*tmsp.Response)) (err error) {
// CACHE
if _, exists := mem.cacheMap[string(tx)]; exists {
cb(&tmsp.Response{
Code: tmsp.CodeType_BadNonce, // TODO or duplicate tx
Log: "Duplicate transaction (ignored)",
})
if cb != nil {
cb(&tmsp.Response{
Code: tmsp.CodeType_BadNonce, // TODO or duplicate tx
Log: "Duplicate transaction (ignored)",
})
}
return nil
}
if mem.cacheList.Len() >= cacheSize {