loan fixes
This commit is contained in:
parent
f9ed67cbc4
commit
4fad309fc2
|
|
@ -38,7 +38,11 @@ pub fn balance_root_path() -> PathBuf {
|
||||||
pub fn canonical_balance_address(address: &str) -> Option<String> {
|
pub fn canonical_balance_address(address: &str) -> Option<String> {
|
||||||
// Balance storage is normalized to the deterministic short address,
|
// Balance storage is normalized to the deterministic short address,
|
||||||
// regardless of whether callers still pass a long or short address.
|
// regardless of whether callers still pass a long or short address.
|
||||||
Wallet::normalize_to_short_address(address)
|
Wallet::normalize_to_short_address(address).or_else(|| {
|
||||||
|
let txid = address.strip_prefix("collateral_")?;
|
||||||
|
(txid.len() == 64 && txid.chars().all(|c| c.is_ascii_hexdigit()))
|
||||||
|
.then(|| address.to_ascii_lowercase())
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn address_root_path(address: &str) -> Option<PathBuf> {
|
pub fn address_root_path(address: &str) -> Option<PathBuf> {
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,12 @@ fn apply_effect(db: &Db, effect: &PendingEffect) -> Result<AppliedEffect, String
|
||||||
operand,
|
operand,
|
||||||
} => {
|
} => {
|
||||||
balance_sheet_operation_with_db(db, address, *amount, coin, operand.as_str())
|
balance_sheet_operation_with_db(db, address, *amount, coin, operand.as_str())
|
||||||
.map_err(|err| format!("Failed to apply balance effect: {err}"))?;
|
.map_err(|err| {
|
||||||
|
format!(
|
||||||
|
"Failed to apply balance effect: {err} address={address} coin={coin:?} amount={amount} operand={}",
|
||||||
|
operand.as_str()
|
||||||
|
)
|
||||||
|
})?;
|
||||||
Ok(AppliedEffect::Balance {
|
Ok(AppliedEffect::Balance {
|
||||||
address: address.clone(),
|
address: address.clone(),
|
||||||
amount: *amount,
|
amount: *amount,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue