@@ -2156,6 +2156,7 @@ impl NakamotoChainState {
2156
2156
Self :: generate_phantom_unlock_tx (
2157
2157
phantom_unlock_events,
2158
2158
& stacks_chain_state. config ( ) ,
2159
+ next_ready_block. header . chain_length ,
2159
2160
)
2160
2161
{
2161
2162
tx_receipts. push ( unlock_receipt) ;
@@ -4920,6 +4921,7 @@ impl NakamotoChainState {
4920
4921
fn generate_phantom_unlock_tx (
4921
4922
events : Vec < StacksTransactionEvent > ,
4922
4923
config : & ChainstateConfig ,
4924
+ stacks_block_height : u64 ,
4923
4925
) -> Option < StacksTransactionReceipt > {
4924
4926
if events. is_empty ( ) {
4925
4927
return None ;
@@ -4930,6 +4932,16 @@ impl NakamotoChainState {
4930
4932
} else {
4931
4933
TransactionVersion :: Testnet
4932
4934
} ;
4935
+
4936
+ // Make the txid unique -- the phantom tx payload should include something block-specific otherwise
4937
+ // they will always have the same txid. In this case we use the block height in the memo. This also
4938
+ // happens to give some indication of the purpose of this phantom tx, for anyone looking.
4939
+ let memo = TokenTransferMemo ( {
4940
+ let str = format ! ( "Block {} token unlocks" , stacks_block_height) ;
4941
+ let mut buf = [ 0u8 ; 34 ] ;
4942
+ buf[ ..str. len ( ) . min ( 34 ) ] . copy_from_slice ( & str. as_bytes ( ) [ ..] ) ;
4943
+ buf
4944
+ } ) ;
4933
4945
let boot_code_address = boot_code_addr ( config. mainnet ) ;
4934
4946
let boot_code_auth = boot_code_tx_auth ( boot_code_address. clone ( ) ) ;
4935
4947
let unlock_tx = StacksTransaction :: new (
@@ -4938,7 +4950,7 @@ impl NakamotoChainState {
4938
4950
TransactionPayload :: TokenTransfer (
4939
4951
PrincipalData :: Standard ( boot_code_address. into ( ) ) ,
4940
4952
0 ,
4941
- TokenTransferMemo ( [ 0u8 ; 34 ] ) ,
4953
+ memo ,
4942
4954
) ,
4943
4955
) ;
4944
4956
let unlock_receipt = StacksTransactionReceipt :: from_stx_transfer (
0 commit comments