Implement getParentsInPool

This commit is contained in:
Mike Zak 2021-06-08 10:16:45 +03:00
parent 2294559198
commit 099f023b5b
2 changed files with 15 additions and 12 deletions

View File

@ -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 {

View File

@ -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
} }