* fix use wrong type of lock bug
* fix wrong type of lock bug
// ExpireOrphan expire all the orphans that before the input time range
func (tp *TxPool) ExpireOrphan(now time.Time) {
- tp.mtx.RLock()
- defer tp.mtx.RUnlock()
+ tp.mtx.Lock()
+ defer tp.mtx.Unlock()
for hash, orphan := range tp.orphans {
if orphan.expiration.Before(now) {
// ProcessTransaction is the main entry for txpool handle new tx
func (tp *TxPool) ProcessTransaction(tx *types.Tx, statusFail bool, height, fee uint64) (bool, error) {
- tp.mtx.RLock()
- defer tp.mtx.RUnlock()
+ tp.mtx.Lock()
+ defer tp.mtx.Unlock()
txD := &TxDesc{
Tx: tx,