本文整理汇总了C++中Wallet::id方法的典型用法代码示例。如果您正苦于以下问题:C++ Wallet::id方法的具体用法?C++ Wallet::id怎么用?C++ Wallet::id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wallet
的用法示例。
在下文中一共展示了Wallet::id方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ABC_ERROR
Status
bridgeWatcherStart(Wallet &self)
{
if (watchers_.end() != watchers_.find(self.id()))
return ABC_ERROR(ABC_CC_Error,
"Watcher already exists for " + self.id());
watchers_[self.id()].reset(new WatcherInfo(self));
return Status();
}
示例2: ABC_BridgeWatcherConnect
tABC_CC ABC_BridgeWatcherConnect(Wallet &self, tABC_Error *pError)
{
tABC_CC cc = ABC_CC_Ok;
tABC_GeneralInfo *ppInfo = NULL;
const char *szServer = FALLBACK_OBELISK;
Watcher *watcher = nullptr;
ABC_CHECK_NEW(watcherFind(watcher, self));
// Pick a server:
if (isTestnet())
{
szServer = TESTNET_OBELISK;
}
else if (ABC_CC_Ok == ABC_GeneralGetInfo(&ppInfo, pError) &&
0 < ppInfo->countObeliskServers)
{
++gLastObelisk;
if (ppInfo->countObeliskServers <= gLastObelisk)
gLastObelisk = 0;
szServer = ppInfo->aszObeliskServers[gLastObelisk];
}
// Connect:
ABC_DebugLog("Wallet %s connecting to %s", self.id().c_str(), szServer);
watcher->connect(szServer);
exit:
ABC_GeneralFreeInfo(ppInfo);
return cc;
}
示例3: Status
Status
bridgeWatcherDelete(Wallet &self)
{
watcherSave(self).log(); // Failure is not fatal
watchers_.erase(self.id());
return Status();
}
示例4: ABC_BridgeWatcherDelete
tABC_CC ABC_BridgeWatcherDelete(Wallet &self, tABC_Error *pError)
{
tABC_CC cc = ABC_CC_Ok;
watcherSave(self); // Failure is not fatal
watchers_.erase(self.id());
return cc;
}
示例5: ABC_ERROR
static Status
watcherFind(WatcherInfo *&result, Wallet &self)
{
std::string id = self.id();
auto row = watchers_.find(id);
if (row == watchers_.end())
return ABC_ERROR(ABC_CC_Synchronizing, "Cannot find watcher for " + id);
result = row->second.get();
return Status();
}
示例6: ABC_BridgeWatcherStart
tABC_CC ABC_BridgeWatcherStart(Wallet &self,
tABC_Error *pError)
{
tABC_CC cc = ABC_CC_Ok;
std::string id = self.id();
if (watchers_.end() != watchers_.find(id))
ABC_RET_ERROR(ABC_CC_Error, ("Watcher already exists for " + id).c_str());
watchers_[id].reset(new WatcherInfo(self));
watcherLoad(self); // Failure is not fatal
exit:
return cc;
}
示例7: ABC_BridgeWatchAddr
tABC_CC ABC_BridgeWatchAddr(Wallet &self,
const char *pubAddress,
tABC_Error *pError)
{
tABC_CC cc = ABC_CC_Ok;
ABC_DebugLog("Watching %s for %s", pubAddress, self.id().c_str());
bc::payment_address addr;
WatcherInfo *watcherInfo = nullptr;
ABC_CHECK_NEW(watcherFind(watcherInfo, self));
if (!addr.set_encoded(pubAddress))
{
cc = ABC_CC_Error;
ABC_DebugLog("Invalid pubAddress %s\n", pubAddress);
goto exit;
}
watcherInfo->addresses.insert(pubAddress);
watcherInfo->watcher.watch_address(addr);
exit:
return cc;
}
示例8: Status
Status
onReceive(Wallet &wallet, const TxInfo &info,
tABC_BitCoin_Event_Callback fCallback, void *pData)
{
wallet.balanceDirty();
ABC_CHECK(wallet.addresses.markOutputs(info));
// Does the transaction already exist?
TxMeta meta;
if (!wallet.txs.get(meta, info.ntxid))
{
const auto balance = wallet.addresses.balance(info);
meta.ntxid = info.ntxid;
meta.txid = info.txid;
meta.timeCreation = time(nullptr);
meta.internal = false;
meta.airbitzFeeWanted = 0;
meta.airbitzFeeSent = 0;
// Receives can accumulate Airbitz fees:
const auto airbitzFeeInfo = generalAirbitzFeeInfo();
meta.airbitzFeeWanted = airbitzFeeIncoming(airbitzFeeInfo, balance);
logInfo("Airbitz fee: " +
std::to_string(meta.airbitzFeeWanted) + " wanted, " +
std::to_string(wallet.txs.airbitzFeePending()) + " pending");
// Grab metadata from the address:
for (const auto &io: info.ios)
{
AddressMeta address;
if (wallet.addresses.get(address, io.address))
meta.metadata = address.metadata;
}
ABC_CHECK(gContext->exchangeCache.satoshiToCurrency(
meta.metadata.amountCurrency, balance,
static_cast<Currency>(wallet.currency())));
// Save the metadata:
ABC_CHECK(wallet.txs.save(meta, balance, info.fee));
// Update the GUI:
ABC_DebugLog("IncomingBitCoin callback: wallet %s, txid: %s",
wallet.id().c_str(), info.txid.c_str());
tABC_AsyncBitCoinInfo async;
async.pData = pData;
async.eventType = ABC_AsyncEventType_IncomingBitCoin;
Status().toError(async.status, ABC_HERE());
async.szWalletUUID = wallet.id().c_str();
async.szTxID = info.txid.c_str();
async.sweepSatoshi = 0;
fCallback(&async);
}
else
{
// Update the GUI:
ABC_DebugLog("BalanceUpdate callback: wallet %s, txid: %s",
wallet.id().c_str(), info.txid.c_str());
tABC_AsyncBitCoinInfo async;
async.pData = pData;
async.eventType = ABC_AsyncEventType_BalanceUpdate;
Status().toError(async.status, ABC_HERE());
async.szWalletUUID = wallet.id().c_str();
async.szTxID = info.txid.c_str();
async.sweepSatoshi = 0;
fCallback(&async);
}
return Status();
}