-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61368ea
commit 8fbcfd6
Showing
7 changed files
with
140 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
package testscommon | ||
|
||
import "github.com/multiversx/mx-chain-go/storage/txcache" | ||
import ( | ||
"time" | ||
|
||
"github.com/multiversx/mx-chain-go/storage/txcache" | ||
) | ||
|
||
type TxCacherStub struct { | ||
CacherStub | ||
SelectTransactionsWithBandwidthCalled func(numRequested int, batchSizePerSender int, bandwidthPerSender uint64) []*txcache.WrappedTransaction | ||
NotifyAccountNonceCalled func(accountKey []byte, nonce uint64) | ||
SelectTransactionsCalled func(session txcache.SelectionSession, gasRequested uint64, maxNum int, selectionLoopMaximumDuration time.Duration) ([]*txcache.WrappedTransaction, uint64) | ||
} | ||
|
||
// SelectTransactionsWithBandwidth - | ||
func (tcs *TxCacherStub) SelectTransactionsWithBandwidth(numRequested int, batchSizePerSender int, bandwidthPerSender uint64) []*txcache.WrappedTransaction { | ||
if tcs.SelectTransactionsWithBandwidthCalled != nil { | ||
return tcs.SelectTransactionsWithBandwidthCalled(numRequested, batchSizePerSender, bandwidthPerSender) | ||
// SelectTransactions - | ||
func (tcs *TxCacherStub) SelectTransactions(session txcache.SelectionSession, gasRequested uint64, maxNum int, selectionLoopMaximumDuration time.Duration) ([]*txcache.WrappedTransaction, uint64) { | ||
if tcs.SelectTransactionsCalled != nil { | ||
return tcs.SelectTransactionsCalled(session, gasRequested, maxNum, selectionLoopMaximumDuration) | ||
} | ||
|
||
return make([]*txcache.WrappedTransaction, 0) | ||
} | ||
|
||
// NotifyAccountNonce - | ||
func (tcs *TxCacherStub) NotifyAccountNonce(accountKey []byte, nonce uint64) { | ||
if tcs.NotifyAccountNonceCalled != nil { | ||
tcs.NotifyAccountNonceCalled(accountKey, nonce) | ||
} | ||
return make([]*txcache.WrappedTransaction, 0), 0 | ||
} |