Skip to content

Commit 522df21

Browse files
authored
Merge pull request #284 from ReyisaRuby/txndb_add
fix ordered txn GetAll
2 parents a2fb265 + 5e7c7e2 commit 522df21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/txpool/ordered.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ func (ot *orderedTxns) SortTxns(fn func(txns []*SignedTxn) []*SignedTxn) {
139139
}
140140

141141
func (ot *orderedTxns) GetAll() []*SignedTxn {
142-
txns := make([]*SignedTxn, 0)
143142
ot.RLock()
144143
defer ot.RUnlock()
144+
txns := make([]*SignedTxn, 0, len(ot.txns))
145145
for _, txn := range ot.txns {
146146
txns = append(txns, txn)
147147
}

0 commit comments

Comments
 (0)