add support for deterministic pub keys
fix a couple of bugs
This commit is contained in:
parent
e5ab0f883e
commit
365d23f0e2
2 changed files with 6 additions and 5 deletions
|
@ -49,11 +49,10 @@ type File struct {
|
||||||
Height int `json:"height"`
|
Height int `json:"height"`
|
||||||
IsFullyReflected bool `json:"is_fully_reflected"`
|
IsFullyReflected bool `json:"is_fully_reflected"`
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
Metadata *lbryschema.Claim `json:"protobuf"`
|
Value *lbryschema.Claim `json:"protobuf"`
|
||||||
MimeType string `json:"mime_type"`
|
MimeType string `json:"mime_type"`
|
||||||
Nout int `json:"nout"`
|
Nout int `json:"nout"`
|
||||||
Outpoint string `json:"outpoint"`
|
Outpoint string `json:"outpoint"`
|
||||||
Protobuf string `json:"protobuf"`
|
|
||||||
PurchaseReceipt interface{} `json:"purchase_receipt"`
|
PurchaseReceipt interface{} `json:"purchase_receipt"`
|
||||||
ReflectorProgress int `json:"reflector_progress"`
|
ReflectorProgress int `json:"reflector_progress"`
|
||||||
SdHash string `json:"sd_hash"`
|
SdHash string `json:"sd_hash"`
|
||||||
|
@ -253,10 +252,9 @@ type Transaction struct {
|
||||||
PermanentUrl string `json:"permanent_url"`
|
PermanentUrl string `json:"permanent_url"`
|
||||||
SigningChannel *Claim `json:"signing_channel,omitempty"`
|
SigningChannel *Claim `json:"signing_channel,omitempty"`
|
||||||
TimeStamp uint64 `json:"time_stamp"`
|
TimeStamp uint64 `json:"time_stamp"`
|
||||||
Protobuf string `json:"protobuf,omitempty"`
|
|
||||||
Txid string `json:"txid"`
|
Txid string `json:"txid"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Value *lbryschema.Claim `json:"protobuf"`
|
Value *lbryschema.Claim `json:"protobuf,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TransactionSummary struct {
|
type TransactionSummary struct {
|
||||||
|
|
|
@ -62,12 +62,15 @@ func PrivateKeyToDER(key *btcec.PrivateKey) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPublicKeyFromBytes(pubKeyBytes []byte) (*btcec.PublicKey, error) {
|
func GetPublicKeyFromBytes(pubKeyBytes []byte) (*btcec.PublicKey, error) {
|
||||||
|
if len(pubKeyBytes) == 33 {
|
||||||
|
return btcec.ParsePubKey(pubKeyBytes, btcec.S256())
|
||||||
|
}
|
||||||
PKInfo := publicKeyInfo{}
|
PKInfo := publicKeyInfo{}
|
||||||
_, err := asn1.Unmarshal(pubKeyBytes, &PKInfo)
|
_, err := asn1.Unmarshal(pubKeyBytes, &PKInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Err(err)
|
return nil, errors.Err(err)
|
||||||
}
|
}
|
||||||
pubkeyBytes1 := []byte(PKInfo.PublicKey.Bytes)
|
pubkeyBytes1 := PKInfo.PublicKey.Bytes
|
||||||
return btcec.ParsePubKey(pubkeyBytes1, btcec.S256())
|
return btcec.ParsePubKey(pubkeyBytes1, btcec.S256())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue