mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-28 16:13:56 +00:00
Implement getParentsInPool
This commit is contained in:
parent
2294559198
commit
099f023b5b
@ -19,18 +19,21 @@ func newMempoolUTXOSet(mp *mempool) *mempoolUTXOSet {
|
||||
}
|
||||
}
|
||||
|
||||
func (mpus *mempoolUTXOSet) getParentsInPool(transaction *model.MempoolTransaction) (model.ParentUTXOsInPool, error) {
|
||||
//parents := model.ParentUTXOsInPool{}
|
||||
func (mpus *mempoolUTXOSet) getParentsInPool(transaction *model.MempoolTransaction) model.ParentUTXOsInPool {
|
||||
parentsInPool := model.ParentUTXOsInPool{}
|
||||
|
||||
//outpoint := &externalapi.DomainOutpoint{
|
||||
// TransactionID: *transaction.TransactionID(),
|
||||
//}
|
||||
//for i, input := transaction.Transaction.Inputs{
|
||||
// outpoint.Index = i
|
||||
// utxo, ok := mpus.getOutpoint(outpoint)
|
||||
//}
|
||||
outpoint := &externalapi.DomainOutpoint{
|
||||
TransactionID: *transaction.TransactionID(),
|
||||
}
|
||||
for i := range transaction.Transaction.Inputs {
|
||||
outpoint.Index = uint32(i)
|
||||
utxo, ok := mpus.getOutpoint(outpoint)
|
||||
if ok {
|
||||
parentsInPool.Set(i, utxo)
|
||||
}
|
||||
}
|
||||
|
||||
panic("mempoolUTXOSet.getParentsInPool not implemented") // TODO (Mike)
|
||||
return parentsInPool
|
||||
}
|
||||
|
||||
func (mpus *mempoolUTXOSet) addTransaction(transaction *model.MempoolTransaction) error {
|
||||
|
||||
@ -6,11 +6,11 @@ import "github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
|
||||
// The utxos are indexed by transaction output index, for convenient access.
|
||||
type ParentUTXOsInPool map[int]externalapi.UTXOEntry
|
||||
|
||||
func (pip ParentUTXOsInPool) GetForIndex(index int) (externalapi.UTXOEntry, bool) {
|
||||
func (pip ParentUTXOsInPool) Get(index int) (externalapi.UTXOEntry, bool) {
|
||||
utxoEntry, ok := pip[index]
|
||||
return utxoEntry, ok
|
||||
}
|
||||
|
||||
func (pip ParentUTXOsInPool) SetIndex(index int, utxoEntry externalapi.UTXOEntry) {
|
||||
func (pip ParentUTXOsInPool) Set(index int, utxoEntry externalapi.UTXOEntry) {
|
||||
pip[index] = utxoEntry
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user