stasatdaglabs 756f40c59a
Sync pruning point UTXO sets incrementally instead of all at once (#1431)
* Replaced the content of MsgIBDRootUTXOSetChunk with pairs of outpoint-utxo entry pairs.

* Rename utxoIter to utxoIterator.

* Add a big stinky TODO on an assert.

* Replace pruningStore staging with a UTXO set iterator.

* Reimplement receiveAndInsertIBDRootUTXOSet.

* Extract OutpointAndUTXOEntryPairsToDomainOutpointAndUTXOEntryPairs into domainconverters.go.

* Pass the outpoint and utxy entry pairs to the pruning store.

* Implement InsertCandidatePruningPointUTXOs.

* Implement ClearCandidatePruningPointUTXOs.

* Implement UpdateCandidatePruningPointMultiset.

* Use the candidate pruning point multiset in updatePruningPoint.

* Implement CandidatePruningPointUTXOIterator.

* Use the pruning point utxo set iterator for StageVirtualUTXOSet.

* Defer ClearCandidatePruningPointUTXOs.

* Implement OverwriteVirtualUTXOSet.

* Implement CommitCandidatePruningPointUTXOSet.

* Implement BeginOverwritingVirtualUTXOSet and FinishOverwritingVirtualUTXOSet.

* Implement overwriteVirtualUTXOSetAndCommitPruningPointUTXOSet.

* Rename ClearCandidatePruningPointUTXOs to ClearCandidatePruningPointData.

* Add missing methods to dbManager.

* Implement PruningPointUTXOs.

* Implement RecoverUTXOIfRequired.

* Delete the utxoserialization package.

* Fix compilation errors in TestValidateAndInsertPruningPoint.

* Switch order of operations in the if statements in PruningPointUTXOs so that Next() wouldn't be unnecessarily called.

* Fix missing pruning point utxo set staging and bad slice length.

* Fix no default multiset in InsertCandidatePruningPointUTXOs.

* Make go vet happy.

* Rename candidateXXX to importedXXX.

* Do some more renaming.

* Rename some more.

* Fix bad MsgIBDRootNotFound logic.

* Fix an error message.

* Simplify receiveIBDRootBlock.

* Fix error message in receiveAndInsertIBDRootUTXOSet.

* Do some more renaming.

* Fix merge errors.

* Fix a bug caused by calling iterator.First() unnecessarily.

* Remove databaseContext from stores and don't use a transaction in ClearXXX functions.

* Simplify receiveAndInsertIBDRootUTXOSet.

* Fix offset count in PruningPointUTXOs().

* Fix readOnlyUTXOIteratorWithDiff.First().

* Split handleRequestIBDRootUTXOSetAndBlockFlow into smaller methods.

* Rename IbdRootNotFound to UnexpectedPruningPoint.

* Rename requestIBDRootHash to requestPruningPointHash.

* Rename IBDRootHash to PruningPointHash.

* Rename RequestIBDRootUTXOSetAndBlock to RequestPruningPointUTXOSetAndBlock.

* Rename IBDRootUTXOSetChunk to PruningPointUTXOSetChunk.

* Rename RequestNextIBDRootUTXOSetChunk to RequestNextPruningPointUTXOSetChunk.

* Rename DoneIBDRootUTXOSetChunks to DonePruningPointUTXOSetChunks.

* Rename remaining references to IBD root.

* Fix an error message.

* Add a check for HadStartedImportingPruningPointUTXOSet in commitVirtualUTXODiff.

* Add a check for HadStartedImportingPruningPointUTXOSet in ImportPruningPointUTXOSetIntoVirtualUTXOSet.

* Move FinishImportingPruningPointUTXOSet closer to HadStartedImportingPruningPointUTXOSet.

* Remove reference to pruningStore in utxoSetIterator.

* Pointerify utxoSetIterator receivers.

* Fix bad insert in CommitImportedPruningPointUTXOSet.

* Rename commitImportedPruningPointUTXOSetAll to applyImportedPruningPointUTXOSet.

* Simplify PruningPointUTXOs.

* Add populateTransactionWithUTXOEntriesFromUTXOSet.

* Fix a TODO comment.

* Rename InsertImportedPruningPointUTXOs to AppendImportedPruningPointUTXOs.

* Extract handleRequestPruningPointUTXOSetAndBlockMessage to a separate method.

* Rename stuff in readOnlyUTXOIteratorWithDiff.First().

* Address toAddIterator in readOnlyUTXOIteratorWithDiff.First().

* Call First() before any full iteration on ReadOnlyUTXOSetIterator.

* Call First() before any full iteration on a database Cursor.

* Put StartImportingPruningPointUTXOSet inside the pruning point transaction.

* Make serializeOutpoint and serializeUTXOEntry free functions in pruningStore.

* Fix readOnlyUTXOIteratorWithDiff.First().

* Fix bad validations in importPruningPoint.

* Remove superfluous call to validateBlockTransactionsAgainstPastUTXO.
2021-01-21 17:24:52 +02:00

110 lines
6.1 KiB
Protocol Buffer

syntax = "proto3";
package protowire;
option go_package = "github.com/kaspanet/kaspad/protowire";
import "p2p.proto";
import "rpc.proto";
message KaspadMessage {
oneof payload {
AddressesMessage addresses = 1;
BlockMessage block = 2;
TransactionMessage transaction = 3;
RequestBlockLocatorMessage requestBlockLocator = 4;
BlockLocatorMessage blockLocator = 5;
RequestAddressesMessage requestAddresses = 6;
RequestHeadersMessage requestHeaders = 7;
RequestNextHeadersMessage requestNextHeaders = 8;
DoneHeadersMessage DoneHeaders = 9;
RequestRelayBlocksMessage requestRelayBlocks = 10;
RequestTransactionsMessage requestTransactions = 12;
BlockMessage ibdBlock = 13;
InvRelayBlockMessage invRelayBlock = 14;
InvTransactionsMessage invTransactions = 15;
PingMessage ping = 16;
PongMessage pong = 17;
VerackMessage verack = 19;
VersionMessage version = 20;
TransactionNotFoundMessage transactionNotFound = 21;
RejectMessage reject = 22;
RequestPruningPointUTXOSetAndBlockMessage requestPruningPointUTXOSetAndBlock = 24;
PruningPointUtxoSetChunkMessage pruningPointUtxoSetChunk = 25;
RequestIBDBlocksMessage requestIBDBlocks = 26;
UnexpectedPruningPointMessage unexpectedPruningPoint = 27;
RequestPruningPointHashMessage requestPruningPointHash = 28;
PruningPointHashMessage pruningPointHash = 29;
IbdBlockLocatorMessage ibdBlockLocator = 30;
IbdBlockLocatorHighestHashMessage ibdBlockLocatorHighestHash = 31;
BlockHeadersMessage blockHeaders = 32;
RequestNextPruningPointUtxoSetChunkMessage requestNextPruningPointUtxoSetChunk = 33;
DonePruningPointUtxoSetChunksMessage donePruningPointUtxoSetChunks = 34;
GetCurrentNetworkRequestMessage getCurrentNetworkRequest = 1001;
GetCurrentNetworkResponseMessage getCurrentNetworkResponse = 1002;
SubmitBlockRequestMessage submitBlockRequest = 1003;
SubmitBlockResponseMessage submitBlockResponse = 1004;
GetBlockTemplateRequestMessage getBlockTemplateRequest = 1005;
GetBlockTemplateResponseMessage getBlockTemplateResponse = 1006;
NotifyBlockAddedRequestMessage notifyBlockAddedRequest = 1007;
NotifyBlockAddedResponseMessage notifyBlockAddedResponse = 1008;
BlockAddedNotificationMessage blockAddedNotification = 1009;
GetPeerAddressesRequestMessage getPeerAddressesRequest = 1010;
GetPeerAddressesResponseMessage getPeerAddressesResponse = 1011;
GetSelectedTipHashRequestMessage getSelectedTipHashRequest = 1012;
GetSelectedTipHashResponseMessage getSelectedTipHashResponse = 1013;
GetMempoolEntryRequestMessage getMempoolEntryRequest = 1014;
GetMempoolEntryResponseMessage getMempoolEntryResponse = 1015;
GetConnectedPeerInfoRequestMessage getConnectedPeerInfoRequest = 1016;
GetConnectedPeerInfoResponseMessage getConnectedPeerInfoResponse = 1017;
AddPeerRequestMessage addPeerRequest = 1018;
AddPeerResponseMessage addPeerResponse = 1019;
SubmitTransactionRequestMessage submitTransactionRequest = 1020;
SubmitTransactionResponseMessage submitTransactionResponse = 1021;
NotifyVirtualSelectedParentChainChangedRequestMessage notifyVirtualSelectedParentChainChangedRequest = 1022;
NotifyVirtualSelectedParentChainChangedResponseMessage notifyVirtualSelectedParentChainChangedResponse = 1023;
VirtualSelectedParentChainChangedNotificationMessage virtualSelectedParentChainChangedNotification = 1024;
GetBlockRequestMessage getBlockRequest = 1025;
GetBlockResponseMessage getBlockResponse = 1026;
GetSubnetworkRequestMessage getSubnetworkRequest = 1027;
GetSubnetworkResponseMessage getSubnetworkResponse = 1028;
GetVirtualSelectedParentChainFromBlockRequestMessage getVirtualSelectedParentChainFromBlockRequest = 1029;
GetVirtualSelectedParentChainFromBlockResponseMessage getVirtualSelectedParentChainFromBlockResponse = 1030;
GetBlocksRequestMessage getBlocksRequest = 1031;
GetBlocksResponseMessage getBlocksResponse = 1032;
GetBlockCountRequestMessage getBlockCountRequest = 1033;
GetBlockCountResponseMessage getBlockCountResponse = 1034;
GetBlockDagInfoRequestMessage getBlockDagInfoRequest = 1035;
GetBlockDagInfoResponseMessage getBlockDagInfoResponse = 1036;
ResolveFinalityConflictRequestMessage resolveFinalityConflictRequest = 1037;
ResolveFinalityConflictResponseMessage resolveFinalityConflictResponse = 1038;
NotifyFinalityConflictsRequestMessage notifyFinalityConflictsRequest = 1039;
NotifyFinalityConflictsResponseMessage notifyFinalityConflictsResponse = 1040;
FinalityConflictNotificationMessage finalityConflictNotification = 1041;
FinalityConflictResolvedNotificationMessage finalityConflictResolvedNotification = 1042;
GetMempoolEntriesRequestMessage getMempoolEntriesRequest = 1043;
GetMempoolEntriesResponseMessage getMempoolEntriesResponse = 1044;
ShutDownRequestMessage shutDownRequest = 1045;
ShutDownResponseMessage shutDownResponse = 1046;
GetHeadersRequestMessage getHeadersRequest = 1047;
GetHeadersResponseMessage getHeadersResponse = 1048;
NotifyUtxosChangedRequestMessage notifyUtxosChangedRequest = 1049;
NotifyUtxosChangedResponseMessage notifyUtxosChangedResponse = 1050;
UtxosChangedNotificationMessage utxosChangedNotification = 1051;
GetUtxosByAddressesRequestMessage getUtxosByAddressesRequest = 1052;
GetUtxosByAddressesResponseMessage getUtxosByAddressesResponse = 1053;
GetVirtualSelectedParentBlueScoreRequestMessage getVirtualSelectedParentBlueScoreRequest = 1054;
GetVirtualSelectedParentBlueScoreResponseMessage getVirtualSelectedParentBlueScoreResponse = 1055;
NotifyVirtualSelectedParentBlueScoreChangedRequestMessage notifyVirtualSelectedParentBlueScoreChangedRequest = 1056;
NotifyVirtualSelectedParentBlueScoreChangedResponseMessage notifyVirtualSelectedParentBlueScoreChangedResponse = 1057;
VirtualSelectedParentBlueScoreChangedNotificationMessage virtualSelectedParentBlueScoreChangedNotification = 1058;
}
}
service P2P {
rpc MessageStream (stream KaspadMessage) returns (stream KaspadMessage) {}
}
service RPC {
rpc MessageStream (stream KaspadMessage) returns (stream KaspadMessage) {}
}