/
orphan_transaction.go
46 lines (39 loc) · 1.4 KB
/
orphan_transaction.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package model
import (
"github.com/BTCGhostdag/BTCD/domain/consensus/model/externalapi"
"github.com/BTCGhostdag/BTCD/domain/consensus/utils/consensushashing"
)
// OrphanTransaction represents a transaction in the OrphanPool
type OrphanTransaction struct {
transaction *externalapi.DomainTransaction
isHighPriority bool
addedAtDAAScore uint64
}
// NewOrphanTransaction constructs a new OrphanTransaction
func NewOrphanTransaction(
transaction *externalapi.DomainTransaction,
isHighPriority bool,
addedAtDAAScore uint64,
) *OrphanTransaction {
return &OrphanTransaction{
transaction: transaction,
isHighPriority: isHighPriority,
addedAtDAAScore: addedAtDAAScore,
}
}
// TransactionID returns the ID of this OrphanTransaction
func (ot *OrphanTransaction) TransactionID() *externalapi.DomainTransactionID {
return consensushashing.TransactionID(ot.transaction)
}
// Transaction return the DomainTransaction associated with this OrphanTransaction:
func (ot *OrphanTransaction) Transaction() *externalapi.DomainTransaction {
return ot.transaction
}
// IsHighPriority returns whether this OrphanTransaction is a high-priority one
func (ot *OrphanTransaction) IsHighPriority() bool {
return ot.isHighPriority
}
// AddedAtDAAScore returns the virtual DAA score at which this OrphanTransaction was added to the mempool
func (ot *OrphanTransaction) AddedAtDAAScore() uint64 {
return ot.addedAtDAAScore
}