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) {
|
func (mpus *mempoolUTXOSet) getParentsInPool(transaction *model.MempoolTransaction) model.ParentUTXOsInPool {
|
||||||
//parents := model.ParentUTXOsInPool{}
|
parentsInPool := model.ParentUTXOsInPool{}
|
||||||
|
|
||||||
//outpoint := &externalapi.DomainOutpoint{
|
outpoint := &externalapi.DomainOutpoint{
|
||||||
// TransactionID: *transaction.TransactionID(),
|
TransactionID: *transaction.TransactionID(),
|
||||||
//}
|
}
|
||||||
//for i, input := transaction.Transaction.Inputs{
|
for i := range transaction.Transaction.Inputs {
|
||||||
// outpoint.Index = i
|
outpoint.Index = uint32(i)
|
||||||
// utxo, ok := mpus.getOutpoint(outpoint)
|
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 {
|
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.
|
// The utxos are indexed by transaction output index, for convenient access.
|
||||||
type ParentUTXOsInPool map[int]externalapi.UTXOEntry
|
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]
|
utxoEntry, ok := pip[index]
|
||||||
return utxoEntry, ok
|
return utxoEntry, ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pip ParentUTXOsInPool) SetIndex(index int, utxoEntry externalapi.UTXOEntry) {
|
func (pip ParentUTXOsInPool) Set(index int, utxoEntry externalapi.UTXOEntry) {
|
||||||
pip[index] = utxoEntry
|
pip[index] = utxoEntry
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user