blockchain: Add IsTreasuryEnabled to AgendaFlags.
This adds an IsTreasuryEnabled method to the AgendaFlags type that returns whether the flags indicate that the treasury agenda is enabled. This is useful since checking the flags directly is pretty verbose, especially when using the type outside of the blockchain package. This also updates existing references to the AgendaFlags type to use the IsTreasuryEnabled function.
This commit is contained in:
parent
4d81fc1b6e
commit
93902730c1
@ -328,6 +328,12 @@ const (
|
||||
AFNone AgendaFlags = 0
|
||||
)
|
||||
|
||||
// IsTreasuryEnabled returns whether the flags indicate that the treasury agenda
|
||||
// is enabled.
|
||||
func (flags AgendaFlags) IsTreasuryEnabled() bool {
|
||||
return flags&AFTreasuryEnabled == AFTreasuryEnabled
|
||||
}
|
||||
|
||||
// checkTransactionContext performs several validation checks on the transaction
|
||||
// which depend on having the full block data for all of its ancestors
|
||||
// available, most likely because the checks depend on whether or not an agenda
|
||||
@ -338,7 +344,7 @@ const (
|
||||
// in order to change how the validation rules are applied accordingly.
|
||||
func checkTransactionContext(tx *wire.MsgTx, params *chaincfg.Params, flags AgendaFlags) error {
|
||||
// Determine active agendas based on flags.
|
||||
isTreasuryEnabled := flags&AFTreasuryEnabled == AFTreasuryEnabled
|
||||
isTreasuryEnabled := flags.IsTreasuryEnabled()
|
||||
|
||||
// Determine type.
|
||||
var isCoinBase, isVote, isTicket, isRevocation bool
|
||||
|
||||
Loading…
Reference in New Issue
Block a user