本文整理汇总了C++中ledger::pointer::has_account方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::has_account方法的具体用法?C++ pointer::has_account怎么用?C++ pointer::has_account使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ledger::pointer
的用法示例。
在下文中一共展示了pointer::has_account方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (){
std::string db_name = "/home/ivanzjj/radix_tree";
RocksdbInstance::set_db_name (db_name);
Ledger::pointer ledger = std::make_shared <Ledger> ();
std::string db_name2 = "/home/ivanzjj/ledger.db";
SqliteInstance::set_db_name (db_name2);
uint256 hash;
char hash_ch[32];
for (int i=0;i<32;i++)
hash_ch[i] = i;
hash.init (hash_ch);
hash.to_string ();
Serializer ss;
char ch[100];
for (int i=0;i<100;i++) ch[i] = i;
ss.add_raw (ch, 100);
if (!ledger->add_account_tree_entry (hash, ss)){
printf ("add_account_tree_entry error!\n");
return 1;
}
// dfs (ledger->get_account_tree ()->get_root (), 0);
for (int i = 0; i < 32; i++){
hash_ch[i] = i;
}
hash_ch[0] = 1;
hash.init (hash_ch);
hash.to_string ();
if (!ledger->add_account_tree_entry (hash, ss)){
printf ("add_account_tree_entry error2\n");
return 1;
}
// dfs (ledger->get_account_tree ()->get_root (), 0);
for (int i = 0; i < 32; i++) hash_ch[i] = i;
hash_ch[0] = 1;
hash_ch[1] = 2;
hash.init (hash_ch);
hash.to_string ();
if (!ledger->add_account_tree_entry (hash, ss)){
printf ("add_account_tree_entry error2\n");
return 1;
}
// dfs (ledger->get_account_tree ()->get_root (), 0);
for (int i = 0; i < 32; i++){
hash_ch[i] = i;
}
hash.init (hash_ch);
if (ledger->has_account (hash)){
hash.to_string ();
printf ("YES\n");
ch[0] = 10;
ss.peek_data ().clear();
ss.add_raw (ch, 100);
RadixMerkleTreeLeaf::pointer new_item = std::make_shared<RadixMerkleTreeLeaf> (hash, ss);
if (!ledger->update_account_tree_entry (new_item)){
printf ("update_account_tree_entry error!\n");
return 1;
}
}
else {
printf ("NO\n");
}
// dfs (ledger->get_account_tree ()->get_root (), 0);
return 0;
}