Add claim protobuf definition for UDP country encoding.

This commit is contained in:
Jeffrey Picard 2021-11-24 15:27:38 -05:00
parent 355eab682c
commit 159f4b941b
3 changed files with 6088 additions and 2 deletions

File diff suppressed because it is too large Load diff

5031
protobuf/go/claim.pb.go Normal file

File diff suppressed because it is too large Load diff

View file

@ -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),