Move pricing and payments into bitswap protobuf message

Only a single message type is forwarded to the rpc handler,
so we add pricing and payment info to that message type.
This commit is contained in:
Mark Spanbroek 2021-04-08 09:22:41 +02:00 committed by markspanbroek
parent 9635f26b90
commit 02ef50ab46
4 changed files with 14 additions and 15 deletions

View File

@ -17,6 +17,7 @@ import_proto3 "message.proto"
export Message
export Wantlist, WantType, Entry
export Block, BlockPresenceType, BlockPresence
export PricingMessage, StateChannelUpdate
proc hash*(e: Entry): Hash =
hash(e.`block`)

View File

@ -37,9 +37,21 @@ message Message {
BlockPresenceType type = 2;
}
message PricingMessage {
bytes address = 1; // Ethereum address to which payments should be made
bytes asset = 2; // Asset (coin) with which to pay
bytes price = 3; // Amount of assets to pay per byte (UInt256)
}
message StateChannelUpdate {
bytes update = 1; // Signed Nitro state, serialized as JSON
}
Wantlist wantlist = 1;
repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0
repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0
repeated BlockPresence blockPresences = 4;
int32 pendingBytes = 5;
PricingMessage pricing = 6;
StateChannelUpdate payment = 7;
}

View File

@ -2,8 +2,7 @@ import pkg/protobuf_serialization
import pkg/nitro
import pkg/questionable
import pkg/upraises
import_proto3 "payments.proto"
import ./bitswap
export PricingMessage
export StateChannelUpdate

View File

@ -1,13 +0,0 @@
syntax = "proto3";
package bitswap.payments.pb;
message PricingMessage {
bytes address = 1; // Ethereum address to which payments should be made
bytes asset = 2; // Asset (coin) with which to pay
bytes price = 3; // Amount of assets to pay per byte (UInt256)
}
message StateChannelUpdate {
bytes update = 1; // Signed Nitro state, serialized as JSON
}