mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-23 07:16:47 +00:00

* [NOD-1579] Rename AcceptedTxIDs to AcceptedTransactionIDs. * [NOD-1579] Add InsertBlockResult to ValidateAndInsertBlock results. * [NOD-1593] Rename InsertBlockResult to BlockInsertionResult. * [NOD-1593] Add SelectedParentChainChanges to AddBlockToVirtual's result. * [NOD-1593] Implement findSelectedParentChainChanges. * [NOD-1593] Implement TestFindSelectedParentChainChanges. * [NOD-1593] Fix a string. * [NOD-1593] Finish implementing TestFindSelectedParentChainChanges. * [NOD-1593] Fix merge errors. * [NOD-1597] Begin implementing UTXOIndex. * [NOD-1597] Connect UTXOIndex to RPC. * [NOD-1597] Connect Consensus to UTXOIndex. * [NOD-1597] Add AcceptanceData to BlockInfo. * [NOD-1597] Implement UTXOIndex.Update(). * [NOD-1597] Implement add(), remove(), and discard() in utxoIndexStore. * [NOD-1597] Add error cases to add() and remove(). * [NOD-1597] Add special cases to add() and remove(). * [NOD-1597] Implement commit. * [NOD-1597] Add a mutex around UTXOIndex.Update(). * [NOD-1597] Return changes to the UTXO from Update(). * [NOD-1597] Add NotifyUTXOsChangedRequestMessage and related structs. * [NOD-1597] Implement HandleNotifyUTXOsChanged. * [NOD-1597] Begin implementing TestUTXOIndex. * [NOD-1597] Implement RegisterForUTXOsChangedNotifications. * [NOD-1597] Fix bad transaction.ID usage. * [NOD-1597] Implement convertUTXOChangesToUTXOsChangedNotification. * [NOD-1597] Make UTXOsChangedNotificationMessage.Removed UTXOsByAddressesEntry instead of just RPCOutpoint so that the client can discern which address was the UTXO removed for. * [NOD-1597] Collect outpoints in TestUTXOIndex. * [NOD-1597] Rename RPC stuff. * [NOD-1597] Add messages for GetUTXOsByAddresses. * [NOD-1597] Implement HandleGetUTXOsByAddresses. * [NOD-1597] Implement GetUTXOsByAddresses. * [NOD-1597] Implement UTXOs(). * [NOD-1597] Implement getUTXOOutpointEntryPairs(). * [NOD-1597] Expand TestUTXOIndex. * [NOD-1597] Convert SubmitTransaction to use RPCTransaction instead of MsgTx. * [NOD-1597] Finish implementing TestUTXOIndex. * [NOD-1597] Add messages for GetVirtualSelectedParentBlueScore. * [NOD-1597] Implement HandleGetVirtualSelectedParentBlueScore and GetVirtualSelectedParentBlueScore. * [NOD-1597] Implement TestVirtualSelectedParentBlueScore. * [NOD-1597] Implement NotifyVirtualSelectedParentBlueScoreChanged. * [NOD-1597] Expand TestVirtualSelectedParentBlueScore. * [NOD-1597] Implement notifyVirtualSelectedParentBlueScoreChanged. * [NOD-1597] Make go lint happy. * [NOD-1593] Fix merge errors. * [NOD-1593] Rename findSelectedParentChainChanges to calculateSelectedParentChainChanges. * [NOD-1593] Expand TestCalculateSelectedParentChainChanges. * [NOD-1597] Add logs to utxoindex.go. * [NOD-1597] Add logs to utxoindex/store.go. * [NOD-1597] Add logs to RPCManager.NotifyXXX functions. * Implement notifySelectedParentChainChanged. * Implement TestSelectedParentChain. * Rename NotifyChainChanged to NotifyVirtualSelectedParentChainChanged. * Rename GetChainFromBlock to GetVirtualSelectedParentChainFromBlock. * Remove AcceptanceIndex from the config. * Implement HandleGetVirtualSelectedParentChainFromBlock. * Expand TestVirtualSelectedParentChain. * Fix merge errors. * Add a comment. * Move a comment.
64 lines
1.7 KiB
Go
64 lines
1.7 KiB
Go
package externalapi
|
|
|
|
// AcceptanceData stores data about which transactions were accepted by a block.
|
|
// It's ordered in the same way as the block merge set blues.
|
|
type AcceptanceData []*BlockAcceptanceData
|
|
|
|
// Clone clones the AcceptanceData
|
|
func (ad AcceptanceData) Clone() AcceptanceData {
|
|
if ad == nil {
|
|
return nil
|
|
}
|
|
clone := make(AcceptanceData, len(ad))
|
|
for i, blockAcceptanceData := range ad {
|
|
clone[i] = blockAcceptanceData.Clone()
|
|
}
|
|
|
|
return clone
|
|
}
|
|
|
|
// BlockAcceptanceData stores all transactions in a block with an indication
|
|
// if they were accepted or not by some other block
|
|
type BlockAcceptanceData struct {
|
|
BlockHash *DomainHash
|
|
TransactionAcceptanceData []*TransactionAcceptanceData
|
|
}
|
|
|
|
// Clone returns a clone of BlockAcceptanceData
|
|
func (bad *BlockAcceptanceData) Clone() *BlockAcceptanceData {
|
|
if bad == nil {
|
|
return nil
|
|
}
|
|
|
|
clone := &BlockAcceptanceData{
|
|
BlockHash: bad.BlockHash,
|
|
TransactionAcceptanceData: make([]*TransactionAcceptanceData, len(bad.TransactionAcceptanceData)),
|
|
}
|
|
for i, acceptanceData := range bad.TransactionAcceptanceData {
|
|
clone.TransactionAcceptanceData[i] = acceptanceData.Clone()
|
|
}
|
|
|
|
return clone
|
|
}
|
|
|
|
// TransactionAcceptanceData stores a transaction together with an indication
|
|
// if it was accepted or not by some block
|
|
type TransactionAcceptanceData struct {
|
|
Transaction *DomainTransaction
|
|
Fee uint64
|
|
IsAccepted bool
|
|
}
|
|
|
|
// Clone returns a clone of TransactionAcceptanceData
|
|
func (tad *TransactionAcceptanceData) Clone() *TransactionAcceptanceData {
|
|
if tad == nil {
|
|
return nil
|
|
}
|
|
|
|
return &TransactionAcceptanceData{
|
|
Transaction: tad.Transaction.Clone(),
|
|
Fee: tad.Fee,
|
|
IsAccepted: tad.IsAccepted,
|
|
}
|
|
}
|