You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using blinded payment paths, the fees of the blinded path should be paid by the recipient, not the sender.
- It is more fair: the sender chooses the non blinded part of the path and pays the corresponding fees, the recipient chooses the blinded part of the path and pays the corresponding fees.
- It is more private: the sender does not learn the actual fees for the path and can't use this information to unblind the path.
@@ -114,12 +114,20 @@ class PgAuditDb(implicit ds: DataSource) extends AuditDb with Logging {
114
114
statement.executeUpdate("CREATE INDEX transactions_published_channel_id_idx ON audit.transactions_published(channel_id)")
115
115
}
116
116
117
+
defmigration1213(statement: Statement):Unit= {
118
+
statement.executeUpdate("ALTER TABLE audit.received RENAME TO received_old")
119
+
statement.executeUpdate("CREATE TABLE audit.received (virtual_amount_msat BIGINT NOT NULL, real_amount_msat BIGINT NOT NULL, payment_hash TEXT NOT NULL, from_channel_id TEXT NOT NULL, timestamp TIMESTAMP WITH TIME ZONE NOT NULL)")
120
+
statement.executeUpdate("INSERT INTO audit.received SELECT amount_msat, amount_msat, payment_hash, from_channel_id, timestamp FROM audit.received_old")
statement.executeUpdate("CREATE INDEX received_timestamp_idx ON audit.received(timestamp)")
123
+
}
124
+
117
125
getVersion(statement, DB_NAME) match {
118
126
caseNone=>
119
127
statement.executeUpdate("CREATE SCHEMA audit")
120
128
121
129
statement.executeUpdate("CREATE TABLE audit.sent (amount_msat BIGINT NOT NULL, fees_msat BIGINT NOT NULL, recipient_amount_msat BIGINT NOT NULL, payment_id TEXT NOT NULL, parent_payment_id TEXT NOT NULL, payment_hash TEXT NOT NULL, payment_preimage TEXT NOT NULL, recipient_node_id TEXT NOT NULL, to_channel_id TEXT NOT NULL, timestamp TIMESTAMP WITH TIME ZONE NOT NULL)")
122
-
statement.executeUpdate("CREATE TABLE audit.received (amount_msat BIGINT NOT NULL, payment_hash TEXT NOT NULL, from_channel_id TEXT NOT NULL, timestamp TIMESTAMP WITH TIME ZONE NOT NULL)")
130
+
statement.executeUpdate("CREATE TABLE audit.received (virtual_amount_msat BIGINT NOT NULL, real_amount_msat BIGINT NOT NULL, payment_hash TEXT NOT NULL, from_channel_id TEXT NOT NULL, timestamp TIMESTAMP WITH TIME ZONE NOT NULL)")
123
131
statement.executeUpdate("CREATE TABLE audit.relayed (payment_hash TEXT NOT NULL, amount_msat BIGINT NOT NULL, channel_id TEXT NOT NULL, direction TEXT NOT NULL, relay_type TEXT NOT NULL, timestamp TIMESTAMP WITH TIME ZONE NOT NULL)")
124
132
statement.executeUpdate("CREATE TABLE audit.relayed_trampoline (payment_hash TEXT NOT NULL, amount_msat BIGINT NOT NULL, next_node_id TEXT NOT NULL, timestamp TIMESTAMP WITH TIME ZONE NOT NULL)")
125
133
statement.executeUpdate("CREATE TABLE audit.channel_events (channel_id TEXT NOT NULL, node_id TEXT NOT NULL, capacity_sat BIGINT NOT NULL, is_funder BOOLEAN NOT NULL, is_private BOOLEAN NOT NULL, event TEXT NOT NULL, timestamp TIMESTAMP WITH TIME ZONE NOT NULL)")
@@ -149,7 +157,7 @@ class PgAuditDb(implicit ds: DataSource) extends AuditDb with Logging {
149
157
statement.executeUpdate("CREATE INDEX transactions_published_channel_id_idx ON audit.transactions_published(channel_id)")
150
158
statement.executeUpdate("CREATE INDEX transactions_published_timestamp_idx ON audit.transactions_published(timestamp)")
151
159
statement.executeUpdate("CREATE INDEX transactions_confirmed_timestamp_idx ON audit.transactions_confirmed(timestamp)")
152
-
caseSome(v@(4|5|6|7|8|9|10|11)) =>
160
+
caseSome(v@(4|5|6|7|8|9|10|11|12)) =>
153
161
logger.warn(s"migrating db $DB_NAME, found version=$v current=$CURRENT_VERSION")
154
162
if (v <5) {
155
163
migration45(statement)
@@ -175,6 +183,9 @@ class PgAuditDb(implicit ds: DataSource) extends AuditDb with Logging {
175
183
if (v <12) {
176
184
migration1112(statement)
177
185
}
186
+
if (v <13) {
187
+
migration1213(statement)
188
+
}
178
189
caseSome(CURRENT_VERSION) => () // table is up-to-date, nothing to do
179
190
caseSome(unknownVersion) =>thrownewRuntimeException(s"Unknown version of DB $DB_NAME found, version=$unknownVersion")
180
191
}
@@ -220,12 +231,13 @@ class PgAuditDb(implicit ds: DataSource) extends AuditDb with Logging {
0 commit comments