Svarog 369a3bac09
Limit block mass instead of merge set limit + Introduce SigOpCount to TransactionInput (#1790)
* Update constants

* Add to transaction SigOpCount

* Update mass calculation, and move it from InContext to InIsolation

* Update block validation accordingly

* Add SigOpCount validation during TransactionInContext

* Remove checking of mass vs maxMassAcceptedByBlock from consensusStateManager

* Update mining manager with latest changes

* Add SigOpCount to MsgTx.Copy()

* Fix initTestTransactionAcceptanceDataForClone

* Fix all tests in transaction_equal_clone_test.go

* Fix TestBlockMass

* Fix tests in transactionvalidator package

* Add SigOpCount to sighash

* Fix TestPruningDepth

* Fix problems in libkaspawalelt

* Fix integration tests

* Fix CalculateSignatureHash tests

* Remove remaining places talking about block size

* Add sanity check to checkBlockMass to make sure all transactions have their mass filled

* always add own sigOpCount to sigHash

* Update protowire/rpc.md

* Start working on removing any remaining reference to block/tx size

* Update rpc transaction verbose data to include mass rather then size

* Convert verboseData and block size check to mass

* Remove remaining usages of tx size in mempool

* Move transactionEstimatedSerializedSize to transactionvalidator

* Add PopulateMass to fakeRelayInvsContext

* Move PopulateMass to beggining of ValidateAndInsertTransaction + fix in it

* Assign mass a new number for backward-compatibility
2021-07-14 14:21:57 +03:00

203 lines
3.4 KiB
Protocol Buffer

syntax = "proto3";
package protowire;
option go_package = "github.com/kaspanet/kaspad/protowire";
message RequestAddressesMessage{
bool includeAllSubnetworks = 1;
SubnetworkId subnetworkId = 2;
}
message AddressesMessage{
repeated NetAddress addressList = 1;
}
message NetAddress{
int64 timestamp = 1;
bytes ip = 3;
uint32 port = 4;
}
message SubnetworkId{
bytes bytes = 1;
}
message TransactionMessage{
uint32 version = 1;
repeated TransactionInput inputs = 2;
repeated TransactionOutput outputs = 3;
uint64 lockTime = 4;
SubnetworkId subnetworkId = 5;
uint64 gas = 6;
bytes payload = 8;
}
message TransactionInput{
Outpoint previousOutpoint = 1;
bytes signatureScript = 2;
uint64 sequence = 3;
uint32 sigOpCount = 4;
}
message Outpoint{
TransactionId transactionId = 1;
uint32 index = 2;
}
message TransactionId{
bytes bytes = 1;
}
message ScriptPublicKey {
bytes script = 1;
uint32 version = 2;
}
message TransactionOutput{
uint64 value = 1;
ScriptPublicKey scriptPublicKey = 2;
}
message BlockMessage{
BlockHeaderMessage header = 1;
repeated TransactionMessage transactions = 2;
}
message BlockHeaderMessage{
uint32 version = 1;
repeated Hash parentHashes = 2;
Hash hashMerkleRoot = 3;
Hash acceptedIdMerkleRoot = 4;
Hash utxoCommitment = 5;
int64 timestamp = 6;
uint32 bits = 7;
uint64 nonce = 8;
}
message Hash{
bytes bytes = 1;
}
message RequestBlockLocatorMessage{
Hash lowHash = 1;
Hash highHash = 2;
uint32 limit = 3;
}
message BlockLocatorMessage{
repeated Hash hashes = 1;
}
message RequestHeadersMessage{
Hash lowHash = 1;
Hash highHash = 2;
}
message RequestNextHeadersMessage{
}
message DoneHeadersMessage{
}
message RequestRelayBlocksMessage{
repeated Hash hashes = 1;
}
message RequestTransactionsMessage {
repeated TransactionId ids = 1;
}
message TransactionNotFoundMessage{
TransactionId id = 1;
}
message InvRelayBlockMessage{
Hash hash = 1;
}
message InvTransactionsMessage{
repeated TransactionId ids = 1;
}
message PingMessage{
uint64 nonce = 1;
}
message PongMessage{
uint64 nonce = 1;
}
message VerackMessage{
}
message VersionMessage{
uint32 protocolVersion = 1;
uint64 services = 2;
int64 timestamp = 3;
NetAddress address = 4;
bytes id = 5;
string userAgent = 6;
bool disableRelayTx = 8;
SubnetworkId subnetworkId = 9;
string network = 10;
}
message RejectMessage{
string reason = 1;
}
message RequestPruningPointUTXOSetAndBlockMessage{
Hash pruningPointHash = 1;
}
message PruningPointUtxoSetChunkMessage{
repeated OutpointAndUtxoEntryPair outpointAndUtxoEntryPairs = 1;
}
message OutpointAndUtxoEntryPair{
Outpoint outpoint = 1;
UtxoEntry utxoEntry = 2;
}
message UtxoEntry {
uint64 amount = 1;
ScriptPublicKey scriptPublicKey = 2;
uint64 blockDaaScore = 3;
bool isCoinbase = 4;
}
message RequestNextPruningPointUtxoSetChunkMessage {
}
message DonePruningPointUtxoSetChunksMessage {
}
message RequestIBDBlocksMessage{
repeated Hash hashes = 1;
}
message UnexpectedPruningPointMessage{
}
message RequestPruningPointHashMessage{
}
message PruningPointHashMessage{
Hash hash = 1;
}
message IbdBlockLocatorMessage {
Hash targetHash = 1;
repeated Hash blockLocatorHashes = 2;
}
message IbdBlockLocatorHighestHashMessage {
Hash highestHash = 1;
}
message IbdBlockLocatorHighestHashNotFoundMessage {
}
message BlockHeadersMessage {
repeated BlockHeaderMessage blockHeaders = 1;
}