finalizeSplice
@totemsdk/omnia-splice / finalizeSplice
Function: finalizeSplice()
finalizeSplice(
channel,proposal,acceptance,options?):Promise<SplicedChannel>
Finalize a splice by assembling both parties' signatures, mining PoW, optionally broadcasting the TX, and returning the new active channel.
Quiesce gate: the channel must be in 'quiesced' state. Call
quiesceChannel first to settle all HTLCs and sign the pre-splice state.
Security checks (all verified before mining):
channel.status === 'quiesced'proposal.spliceId === acceptance.spliceIdproposal.channelIdandacceptance.channelIdmatchchannel.channelId- Proposer and acceptor are distinct, non-empty-keyed channel parties
- Both signatures are non-empty byte arrays
- Both signatures pass cryptographic verification against the splice TX
digest (WOTS by default; override with
options.verifySignaturein tests) spliceTxDraftdigest matches whatbuildSpliceTx(channel, params)produces
WOTS lease lifecycle:
- If
options.proposerLeaseProvideris supplied:commitKeyUseis called after a confirmed splice TX, orburnReservationon failure. - Same for
options.acceptorLeaseProvider. - Reservations are tracked independently; only uncommitted ones are burned.
Broadcast failure: if broadcast() returns { success: false } without
a txpowid, finalizeSplice throws and burns any open reservations.
Side effect: the channel object passed in is mutated to
status: 'spliced' after a successful finalize. This marks the old
quiesced channel as invalid; only the returned SplicedChannel is live.
Returned SplicedChannel:
status: 'active'— ready for new payments immediatelytotalValue— updated toproposal.params.newTotalValuebalances— updated toproposal.params.newBalancescurrentSequence: 0— fresh WOTS budgetlatestState: null— no cosigned state yetsplicedFrom— old channel'schannelIdspliceFundingTxId— mined (or broadcast) TX IDspliceFundingCoinId—<txId>-0
Parameters
channel
OmniaChannel | QuiescedChannel
Quiesced channel (mutated to 'spliced' on success).
proposal
Splice proposal from the initiating party.
acceptance
Co-signature from the accepting party.
options?
Broadcast, difficulty, verifier, and lease providers.
Returns
Promise<SplicedChannel>
SplicedChannel (status: 'active') with updated value and provenance.