commit 4357ac9434f43bbb6f486328e78e0bcddd30f64b
parent 00102bae1627ba54bfa3ba9506edad1b55c5c6cb
Author: bohdan-potuzhnyi <bohdan.potuzhnyi@gmail.com>
Date: Tue, 25 Nov 2025 22:09:14 +0100
100 million change
Diffstat:
8 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -121,7 +121,7 @@ struct InventoryProduct
uint64_t quantity;
/**
- * Fractional part of the quantity in units of 1/100000000 of the base value.
+ * Fractional part of the quantity in units of 1/1000000 of the base value.
*/
uint32_t quantity_frac;
diff --git a/src/backenddb/merchant-0027.sql b/src/backenddb/merchant-0027.sql
@@ -40,17 +40,17 @@ WHERE price IS NOT NULL; -- theoretically all objects, but just to be sure
ALTER TABLE merchant_inventory
ADD COLUMN total_stock_frac INT4 NOT NULL DEFAULT 0;
COMMENT ON COLUMN merchant_inventory.total_stock_frac
- IS 'Fractional part of stock in units of 1/100000000 of the base value';
+ IS 'Fractional part of stock in units of 1/1000000 of the base value';
ALTER TABLE merchant_inventory
ADD COLUMN total_sold_frac INT4 NOT NULL DEFAULT 0;
COMMENT ON COLUMN merchant_inventory.total_sold_frac
- IS 'Fractional part of units sold in units of 1/100000000 of the base value';
+ IS 'Fractional part of units sold in units of 1/1000000 of the base value';
ALTER TABLE merchant_inventory
ADD COLUMN total_lost_frac INT4 NOT NULL DEFAULT 0;
COMMENT ON COLUMN merchant_inventory.total_lost_frac
- IS 'Fractional part of units lost in units of 1/100000000 of the base value';
+ IS 'Fractional part of units lost in units of 1/1000000 of the base value';
ALTER TABLE merchant_inventory
ADD COLUMN allow_fractional_quantity BOOL NOT NULL DEFAULT FALSE;
@@ -65,12 +65,12 @@ COMMENT ON COLUMN merchant_inventory.fractional_precision_level
ALTER TABLE merchant_inventory_locks
ADD COLUMN total_locked_frac INT4 NOT NULL DEFAULT 0;
COMMENT ON COLUMN merchant_inventory_locks.total_locked_frac
- IS 'Fractional part of locked stock in units of 1/100000000 of the base value';
+ IS 'Fractional part of locked stock in units of 1/1000000 of the base value';
ALTER TABLE merchant_order_locks
ADD COLUMN total_locked_frac INT4 NOT NULL DEFAULT 0;
COMMENT ON COLUMN merchant_order_locks.total_locked_frac
- IS 'Fractional part of locked stock associated with orders in units of 1/100000000 of the base value';
+ IS 'Fractional part of locked stock associated with orders in units of 1/1000000 of the base value';
CREATE TABLE merchant_builtin_units
(
diff --git a/src/backenddb/pg_insert_order_lock.c b/src/backenddb/pg_insert_order_lock.c
@@ -75,19 +75,19 @@ TMH_PG_insert_order_lock (void *cls,
" AND (tmp.allow_fractional_quantity OR $5 = 0)"
" AND (tmp.total_stock = 9223372036854775807"
" OR ("
- " (tmp.total_stock::NUMERIC * 100000000"
+ " (tmp.total_stock::NUMERIC * 1000000"
" + tmp.total_stock_frac::NUMERIC)"
- " - (tmp.total_sold::NUMERIC * 100000000"
+ " - (tmp.total_sold::NUMERIC * 1000000"
" + tmp.total_sold_frac::NUMERIC)"
- " - (tmp.total_lost::NUMERIC * 100000000"
+ " - (tmp.total_lost::NUMERIC * 1000000"
" + tmp.total_lost_frac::NUMERIC)"
" >= "
- " (($4::NUMERIC * 100000000) + $5::NUMERIC)"
- " + (SELECT COALESCE(SUM(total_locked::NUMERIC * 100000000"
+ " (($4::NUMERIC * 1000000) + $5::NUMERIC)"
+ " + (SELECT COALESCE(SUM(total_locked::NUMERIC * 1000000"
" + total_locked_frac::NUMERIC), 0)"
" FROM merchant_inventory_locks mil"
" WHERE mil.product_serial = tmp.product_serial)"
- " + (SELECT COALESCE(SUM(total_locked::NUMERIC * 100000000"
+ " + (SELECT COALESCE(SUM(total_locked::NUMERIC * 1000000"
" + total_locked_frac::NUMERIC), 0)"
" FROM merchant_order_locks mol"
" WHERE mol.product_serial = tmp.product_serial)"
diff --git a/src/backenddb/pg_insert_order_lock.h b/src/backenddb/pg_insert_order_lock.h
@@ -34,7 +34,7 @@
* @param product_id uniquely identifies the product to be locked
* @param quantity how many units should be locked to the @a order_id
* @param quantity_frac fractional component of the quantity in units of
- * 1/100000000 of the base value
+ * 1/1000000 of the base value
* @return transaction status,
* #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS means there are insufficient stocks
* #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT indicates success
diff --git a/src/backenddb/pg_lock_product.h b/src/backenddb/pg_lock_product.h
@@ -35,7 +35,7 @@
* @param uuid the UUID that holds the lock
* @param quantity how many units should be locked
* @param quantity_frac fractional component of quantity in units of
- * 1/100000000 of the base value
+ * 1/1000000 of the base value
* @param expiration_time when should the lock expire
* @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the
* product is unknown OR if there insufficient stocks remaining
diff --git a/src/backenddb/pg_mark_contract_paid.c b/src/backenddb/pg_mark_contract_paid.c
@@ -81,10 +81,10 @@ TMH_PG_mark_contract_paid (
" total_sold = total_sold"
" + order_locks.total_locked"
" + ((merchant_inventory.total_sold_frac::BIGINT"
- " + order_locks.total_locked_frac::BIGINT) / 100000000)"
+ " + order_locks.total_locked_frac::BIGINT) / 1000000)"
" ,total_sold_frac ="
" ((merchant_inventory.total_sold_frac::BIGINT"
- " + order_locks.total_locked_frac::BIGINT) % 100000000)::INT4"
+ " + order_locks.total_locked_frac::BIGINT) % 1000000)::INT4"
" FROM (SELECT total_locked,total_locked_frac,product_serial"
" FROM merchant_order_locks"
" WHERE order_serial="
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
@@ -2186,7 +2186,7 @@ typedef void
* @param quantity how much product should be locked (integer part)
* @param quantity_frac fractional component to lock when
* @a use_fractional_quantity is true; value is expressed in units of
- * 1/100000000 of the base unit
+ * 1/1000000 of the base unit
* @param use_fractional_quantity set to true when @a quantity_frac is used
* @param cb function to call with the backend's lock status
* @param cb_cls closure for @a cb
@@ -2631,7 +2631,7 @@ struct TALER_MERCHANT_InventoryProduct
uint64_t quantity;
/**
- * Fractional component of the quantity in units of 1/100000000 of the
+ * Fractional component of the quantity in units of 1/1000000 of the
* base value.
*/
uint32_t quantity_frac;
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
@@ -379,7 +379,7 @@ struct TALER_MERCHANTDB_ProductDetails
uint64_t total_stock;
/**
- * Fractional part of stock in units of 1/100000000 of the base value.
+ * Fractional part of stock in units of 1/1000000 of the base value.
*/
uint32_t total_stock_frac;
@@ -400,7 +400,7 @@ struct TALER_MERCHANTDB_ProductDetails
uint64_t total_sold;
/**
- * Fractional part of units sold in units of 1/100000000 of the base value.
+ * Fractional part of units sold in units of 1/1000000 of the base value.
*/
uint32_t total_sold_frac;
@@ -410,7 +410,7 @@ struct TALER_MERCHANTDB_ProductDetails
uint64_t total_lost;
/**
- * Fractional part of lost units in units of 1/100000000 of the base value.
+ * Fractional part of lost units in units of 1/1000000 of the base value.
*/
uint32_t total_lost_frac;
@@ -2425,7 +2425,7 @@ struct TALER_MERCHANTDB_Plugin
* @param uuid the UUID that holds the lock
* @param quantity how many units should be locked
* @param quantity_frac fractional component of units to lock, in units of
- * 1/100000000 of the base value
+ * 1/1000000 of the base value
* @param expiration_time when should the lock expire
* @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the
* product is unknown OR if there insufficient stocks remaining
@@ -2598,7 +2598,7 @@ struct TALER_MERCHANTDB_Plugin
* @param product_id uniquely identifies the product to be locked
* @param quantity how many units should be locked to the @a order_id
* @param quantity_frac fractional component of the quantity to be locked,
- * in units of 1/100000000 of the base value
+ * in units of 1/1000000 of the base value
* @return transaction status,
* #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS means there are insufficient stocks
* #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT indicates success