Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set complete=false in redeemmultisigout on invalid sigs #2274

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions internal/rpc/jsonrpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -4946,10 +4946,7 @@ func (s *Server) signRawTransaction(ctx context.Context, icmd any) (any, error)
// `complete' denotes that we successfully signed all outputs and that
// all scripts will run to completion. This is returned as part of the
// reply.
signErrs, err := w.SignTransaction(ctx, tx, hashType, inputs, keys, scripts)
if err != nil {
return nil, err
}
signErrs, signErr := w.SignTransaction(ctx, tx, hashType, inputs, keys, scripts)

var b strings.Builder
b.Grow(2 * tx.SerializeSize())
Expand All @@ -4972,7 +4969,7 @@ func (s *Server) signRawTransaction(ctx context.Context, icmd any) (any, error)

return types.SignRawTransactionResult{
Hex: b.String(),
Complete: len(signErrors) == 0,
Complete: len(signErrors) == 0 && signErr == nil,
Errors: signErrors,
}, nil
}
Expand Down
7 changes: 5 additions & 2 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -4833,6 +4833,7 @@ func (w *Wallet) SignTransaction(ctx context.Context, tx *wire.MsgTx, hashType t
err := walletdb.View(ctx, w.db, func(dbtx walletdb.ReadTx) error {
addrmgrNs := dbtx.ReadBucket(waddrmgrNamespaceKey)
txmgrNs := dbtx.ReadBucket(wtxmgrNamespaceKey)
var errEval error

for i, txIn := range tx.TxIn {
// For an SSGen tx, skip the first input as it is a stake base
Expand Down Expand Up @@ -4931,6 +4932,8 @@ func (w *Wallet) SignTransaction(ctx context.Context, tx *wire.MsgTx, hashType t
multisigNotEnoughSigs = true
}
}
} else {
errEval = err
}
// Only report an error for the script engine in the event
// that it's not a multisignature underflow, indicating that
Expand All @@ -4944,10 +4947,10 @@ func (w *Wallet) SignTransaction(ctx context.Context, tx *wire.MsgTx, hashType t
}
}
}
return nil
return errEval
})
if err != nil {
return nil, errors.E(op, err)
return signErrors, errors.E(op, err)
}
return signErrors, nil
}
Expand Down