if err != nil {
return nil, nil, err
}
-
sigInst.AddRawWitnessKeys(signer.XPubs, path, signer.Quorum)
derivedXPubs := csp.DeriveXPubs(signer.XPubs, path)
+ /////////
+ if len(derivedXPubs) == 0 {
+ panic("UtxoToInputs derivedXPubs is nil.")
+ }
+
switch address.(type) {
case *common.AddressWitnessPubKeyHash:
switch dxpub := derivedXPubs[0].(type) {
if xpubBytes, err := hex.DecodeString(str); err != nil {
return nil, err
} else {
-
fmt.Println("NewXPub xpub is:", xpub)
fmt.Println("NewXPub xpubBytes is:", xpubBytes)
copy(xpub[:], xpubBytes[:])
if inp.ControlProgram != nil {
continue
}
- acc := &account.Account{Signer: &signers.Signer{KeyIndex: insts[i].keyIndex, DeriveRule: signers.BIP0044, XPubs: []vcrypto.XPubKeyer{xPubs}, Quorum: insts[i].quorum}}
+ xpubers := make([]vcrypto.XPubKeyer, len(xPubs))
+ for i, xpub := range xPubs {
+ xpubers[i] = xpub
+ }
+ acc := &account.Account{Signer: &signers.Signer{KeyIndex: insts[i].keyIndex, DeriveRule: signers.BIP0044, XPubs: xpubers, Quorum: insts[i].quorum}}
program, err := account.CreateCtrlProgram(acc, insts[i].ctrlProgramIndex, insts[i].change)
if err != nil {
panic(err)
derivePK := childPrv.XPub()
arguments = append(arguments, derivePK.PublicKey())
} else {
- derivedXPubs := csp.DeriveXPubs([]vcrypto.XPubKeyer{xPubs}, path)
+ xpubers := make([]vcrypto.XPubKeyer, len(xPubs))
+ for i, xpub := range xPubs {
+ xpubers[i] = xpub
+ }
+ derivedXPubs := csp.DeriveXPubs(xpubers, path)
derivedPKs := csp.XPubKeys(derivedXPubs)
script, err := vmutil.P2SPMultiSigProgram(derivedPKs, inst.quorum)
if err != nil {
}
fmt.Println("TestMemPoolTxQueryLoop xpub1 is:", xpub1)
- edXPub := new(edchainkd.XPub)
+ edXPub := edchainkd.XPub{}
edXPubKey, _ := hex.DecodeString("e0072a38408cfe4b70d322f8ed2d8acecab41615d2f091ddcd0d0622a8003de915569bd3e316d7e3c44ebebd21bfcc84f6428e60dbf17bef34f2e04a62f6cd2b")
copy(edXPub[:], edXPubKey[:])
xpub2 := pseudohsm.XPub{
XPub: edXPub,
File: "",
}
+ xpubers := make([]vcrypto.XPubKeyer, 1)
+ xpubers[0] = xpub2.XPub
- testAccount, err := accountManager.Create([]vcrypto.XPubKeyer{xpub2.XPub}, 1, "testAccount", signers.BIP0044)
+ testAccount, err := accountManager.Create(xpubers, 1, "testAccount", signers.BIP0044)
if err != nil {
t.Fatal(err)
}
fmt.Println("TestMemPoolTxQueryLoop testAccount is:", testAccount)
+ fmt.Println("TestMemPoolTxQueryLoop testAccount xpubs is:", testAccount.XPubs[0])
+ fmt.Println("TestMemPoolTxQueryLoop testAccount xpubs type is:", reflect.TypeOf(testAccount.XPubs[0]))
controlProg, err := accountManager.CreateAddress(testAccount.ID, false)
if err != nil {