Skip to content

Commit 07d5e0d

Browse files
committedApr 28, 2024··
Fix behavior of wait_for_spend so it tracks known StandardP2TR outputs in the manager
1 parent 677035f commit 07d5e0d

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed
 

‎matt/manager.py

+16-15
Original file line numberDiff line numberDiff line change
@@ -599,25 +599,26 @@ def wait_for_spend(self, instances: Union[ContractInstance, List[ContractInstanc
599599
out_contract = clause_output.next_contract
600600
new_instance = ContractInstance(out_contract)
601601

602-
if isinstance(out_contract, (P2TR, OpaqueP2TR, StandardP2TR)):
603-
continue # nothing to do, will not track this output
604-
elif isinstance(out_contract, StandardAugmentedP2TR):
605-
if clause_output.next_state is None:
606-
raise ValueError("Missing data for augmented output")
607-
new_instance.data = clause_output.next_state.encode()
608-
new_instance.data_expanded = clause_output.next_state
609-
else:
610-
raise ValueError("Unsupported contract type")
602+
if isinstance(out_contract, (StandardP2TR, StandardAugmentedP2TR)):
603+
if isinstance(out_contract, StandardAugmentedP2TR):
604+
if clause_output.next_state is None:
605+
raise ValueError("Missing data for augmented output")
606+
new_instance.data = clause_output.next_state.encode()
607+
new_instance.data_expanded = clause_output.next_state
611608

612-
new_instance.last_height = instance.last_height
609+
new_instance.last_height = instance.last_height
613610

614-
new_instance.outpoint = COutPoint(int(tx.hash, 16), output_index)
615-
new_instance.funding_tx = tx
616-
new_instance.status = ContractInstanceStatus.FUNDED
611+
new_instance.outpoint = COutPoint(int(tx.hash, 16), output_index)
612+
new_instance.funding_tx = tx
613+
new_instance.status = ContractInstanceStatus.FUNDED
617614

618-
out_contracts[output_index] = new_instance
615+
out_contracts[output_index] = new_instance
619616

620-
next_instances.append(new_instance)
617+
next_instances.append(new_instance)
618+
elif isinstance(out_contract, (P2TR, OpaqueP2TR)):
619+
continue # nothing to do, will not track this output
620+
else:
621+
raise ValueError("Unsupported contract type")
621622
instance.next = next_instances
622623

623624
result = list(out_contracts.values())

0 commit comments

Comments
 (0)
Please sign in to comment.