@@ -912,7 +912,7 @@ type StakeVoteDelegationCertificate struct {
912912 cbor.DecodeStoreCbor
913913 CertType uint
914914 StakeCredential Credential
915- PoolKeyHash [] byte
915+ PoolKeyHash PoolKeyHash
916916 Drep Drep
917917}
918918
@@ -937,25 +937,6 @@ func (c *StakeVoteDelegationCertificate) Utxorpc() (*utxorpc.Certificate, error)
937937 if err != nil {
938938 return nil , fmt .Errorf ("failed to convert DRep: %w" , err )
939939 }
940- var drepBytes []byte
941-
942- // Extract DRep credential if it exists (AddrKeyHash or ScriptHash)
943- if drepProto != nil {
944- switch drepProto .GetDrep ().(type ) {
945- case * utxorpc.DRep_AddrKeyHash :
946- drepBytes = drepProto .GetAddrKeyHash ()
947- case * utxorpc.DRep_ScriptHash :
948- drepBytes = drepProto .GetScriptHash ()
949- }
950- }
951-
952- // Encode both PoolKeyHash and DRep in PoolKeyhash field
953- // Format: [1-byte type][poolKeyHash][drepBytes]
954- encodedKey := make ([]byte , 0 , 1 + len (c .PoolKeyHash )+ len (drepBytes ))
955- encodedKey = append (encodedKey , byte (0x01 )) // Version byte
956- encodedKey = append (encodedKey , c .PoolKeyHash ... )
957- encodedKey = append (encodedKey , drepBytes ... )
958-
959940 stakeCred , err := c .StakeCredential .Utxorpc ()
960941 if err != nil {
961942 return nil , err
@@ -964,7 +945,7 @@ func (c *StakeVoteDelegationCertificate) Utxorpc() (*utxorpc.Certificate, error)
964945 Certificate : & utxorpc.Certificate_StakeVoteDelegCert {
965946 StakeVoteDelegCert : & utxorpc.StakeVoteDelegCert {
966947 StakeCredential : stakeCred ,
967- PoolKeyhash : encodedKey ,
948+ PoolKeyhash : c . PoolKeyHash [:] ,
968949 Drep : drepProto ,
969950 },
970951 },
@@ -980,7 +961,7 @@ type StakeRegistrationDelegationCertificate struct {
980961 cbor.DecodeStoreCbor
981962 CertType uint
982963 StakeCredential Credential
983- PoolKeyHash [] byte
964+ PoolKeyHash PoolKeyHash
984965 Amount int64
985966}
986967
@@ -1008,7 +989,7 @@ func (c *StakeRegistrationDelegationCertificate) Utxorpc() (*utxorpc.Certificate
1008989 Certificate : & utxorpc.Certificate_StakeRegDelegCert {
1009990 StakeRegDelegCert : & utxorpc.StakeRegDelegCert {
1010991 StakeCredential : stakeCred ,
1011- PoolKeyhash : c .PoolKeyHash ,
992+ PoolKeyhash : c .PoolKeyHash [:] ,
1012993 },
1013994 },
1014995 }, nil
0 commit comments