Commit c821b93
committed
mempool: add interface compliance checks for OrphanManager and FeeEstimator
In this commit, we add compile-time interface compliance checks for
OrphanManager and FeeEstimator, ensuring they correctly implement the
OrphanTxManager and TxFeeEstimator interfaces respectively.
These var _ InterfaceType = (*ConcreteType)(nil) declarations are a Go
idiom for compile-time interface verification. If OrphanManager doesn't
implement all methods of OrphanTxManager, or FeeEstimator doesn't
implement TxFeeEstimator, the code will fail to compile with a clear
error message.
This is particularly valuable during refactoring, as it ensures that if
we change an interface method signature, all implementations are updated
accordingly. The checks have zero runtime cost and serve as living
documentation of the implementation relationships.1 parent 1930f49 commit c821b93
2 files changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
756 | 756 | | |
757 | 757 | | |
758 | 758 | | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
0 commit comments