Skip to content

Commit

Permalink
fixup! coins: use the chain's BIP173 name instead of a 'unit of account'
Browse files Browse the repository at this point in the history
  • Loading branch information
rustyrussell authored and niftynei committed Apr 16, 2020
1 parent 807cfeb commit 9a19635
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions doc/PLUGINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ i.e. only definitively resolved HTLCs or confirmed bitcoin transactions.
"tag":"deposit",
"blockheight":102, // (`channel_mvt` type only. may be null)
"timestamp":1585948198,
"chain_id":"bc"
"coin_type":"bc"
}
}
```
Expand Down Expand Up @@ -596,7 +596,7 @@ before confirmation.
The `timestamp` is seconds since Unix epoch of the node's machine time
at the time lightningd broadcasts the notification.

`chain_id` is the BIP173 name for the chain this coin movement occurred on.
`coin_type` is the BIP173 name for the coin which moved.


## Hooks
Expand Down
2 changes: 1 addition & 1 deletion lightningd/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ static void coin_movement_notification_serialize(struct json_stream *stream,
json_add_null(stream, "blockheight");
}
json_add_u32(stream, "timestamp", mvt->timestamp);
json_add_string(stream, "chain_id", mvt->bip173_name);
json_add_string(stream, "coin_type", mvt->bip173_name);

json_object_end(stream);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/coin_movements.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def notify_coin_movement(plugin, coin_movement, **kwargs):
plugin.log("{} coins debit: {}".format(idx, coin_movement['debit']))
plugin.log("{} coins tag: {}".format(idx, coin_movement['tag']))
plugin.log("{} coins timestamp: {}".format(idx, coin_movement['timestamp']))
plugin.log("{} coins chain_id: {}".format(idx, coin_movement['chain_id']))
plugin.log("{} coins coin_type: {}".format(idx, coin_movement['coin_type']))

for f in ['payment_hash', 'utxo_txid', 'vout', 'txid', 'part_id', 'blockheight']:
if f in coin_movement:
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def check_coin_moves(n, account_id, expected_moves):
assert mv['debit'] == "{}msat".format(exp['debit'])
assert mv['tag'] == exp['tag']
assert mv['timestamp'] > 0
assert mv['chain_id'] == 'bcrt'
assert mv['coin_type'] == 'bcrt'
# chain moves should have blockheights
if mv['type'] == 'chain_mvt':
assert mv['blockheight'] is not None
Expand Down

0 comments on commit 9a19635

Please sign in to comment.