Add claim protobuf definition for UDP country encoding.
This commit is contained in:
parent
355eab682c
commit
159f4b941b
3 changed files with 6088 additions and 2 deletions
1051
protobuf/definitions/claim.proto
Normal file
1051
protobuf/definitions/claim.proto
Normal file
File diff suppressed because it is too large
Load diff
5031
protobuf/go/claim.pb.go
Normal file
5031
protobuf/go/claim.pb.go
Normal file
File diff suppressed because it is too large
Load diff
|
@ -7,6 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
pb "github.com/lbryio/hub/protobuf/go"
|
||||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -75,10 +76,13 @@ func (pong *SPVPong) Encode() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// makeSPVPong creates an SPVPong struct according to given parameters.
|
// makeSPVPong creates an SPVPong struct according to given parameters.
|
||||||
// FIXME: Currently, does not correctly encode the country.
|
|
||||||
func makeSPVPong(flags int, height int, tip []byte, sourceAddr string, country string) *SPVPong {
|
func makeSPVPong(flags int, height int, tip []byte, sourceAddr string, country string) *SPVPong {
|
||||||
byteAddr := EncodeAddress(sourceAddr)
|
byteAddr := EncodeAddress(sourceAddr)
|
||||||
countryInt := 1
|
var countryInt int32
|
||||||
|
var ok bool
|
||||||
|
if countryInt, ok = pb.Location_Country_value[country]; !ok {
|
||||||
|
countryInt = int32(pb.Location_UNKNOWN_COUNTRY)
|
||||||
|
}
|
||||||
return &SPVPong{
|
return &SPVPong{
|
||||||
protocolVersion: protocolVersion,
|
protocolVersion: protocolVersion,
|
||||||
flags: byte(flags),
|
flags: byte(flags),
|
||||||
|
|
Loading…
Add table
Reference in a new issue