You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case because the fee payer and the user are actually different wallets, the transaction needs two signatures.
So I sign the transaction using both the feePayer and the owner of the account I'm transferring from as follows
When I check the transaction signatures, there are four signatures provided instead of just two, the signatures provided are actually just repeating twice. So I checked the Sign function, turns out
func (tx*Transaction) Sign(getterprivateKeyGetter) (out []Signature, errerror) {
messageContent, err:=tx.Message.MarshalBinary()
iferr!=nil {
returnnil, fmt.Errorf("unable to encode message for signing: %w", err)
}
signerKeys:=tx.Message.signerKeys()
for_, key:=rangesignerKeys {
privateKey:=getter(key)
ifprivateKey==nil {
returnnil, fmt.Errorf("signer key %q not found. Ensure all the signer keys are in the vault", key.String())
}
s, err:=privateKey.Sign(messageContent)
iferr!=nil {
returnnil, fmt.Errorf("failed to signed with key %q: %w", key.String(), err)
}
tx.Signatures=append(tx.Signatures, s)
}
returntx.Signatures, nil
}
That's the reason why there are double the number of unique signatures.
So the transaction verification fails.
When I manually remove the repeating signatures and send the transaction it broadcasts just fine and it's a valid transaction.
Wondering if this is a bug or my mistake maybe for this kind of transaction I need to sign the transaction differently
The text was updated successfully, but these errors were encountered:
Thanks for the help, closing this.
It was my bad. Didn't pay attention to Sign function it actually gets called multiple times so I should only call it once.
I'm trying to make a transaction where I pay fee for another user's transfer.
In this case because the fee payer and the user are actually different wallets, the transaction needs two signatures.
So I sign the transaction using both the feePayer and the owner of the account I'm transferring from as follows
When I check the transaction signatures, there are four signatures provided instead of just two, the signatures provided are actually just repeating twice. So I checked the Sign function, turns out
That's the reason why there are double the number of unique signatures.
So the transaction verification fails.
When I manually remove the repeating signatures and send the transaction it broadcasts just fine and it's a valid transaction.
Wondering if this is a bug or my mistake maybe for this kind of transaction I need to sign the transaction differently
The text was updated successfully, but these errors were encountered: