8月 072018
 

Ripple为历史交易数据查询启用总账历史维护

查看节点node的本地总账数据库编号范围

[tom@node ripple]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 06:58:46.893224092 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "9-140454",
[tom@node ripple]$

查询一笔先前提交的交易详情

[tom@node ripple]$ rippled tx 6A7F157E02AB0E9E134D1F48110413ABF5CA29D61824E3358AAA516D3B6CB67D --conf /usr/local/ripple/etc/rippled.cfg 
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 06:58:52.518035660 HTTPClient:NFO Connecting to 127.0.0.1:8008

{
"result" : {
"Account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"Fee" : "10",
"Flags" : 2147483648,
"RegularKey" : "rac2ReJMqmtpUAysDiNnxurmEY6iwVns82",
"Sequence" : 1,
"SigningPubKey" : "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
"TransactionType" : "SetRegularKey",
"TxnSignature" : "30440220011A56103E3FCFD990879A9E7BE30F9FF3DA618227772C23513D97FCF7E9FBF502201C2A15D155F73615B3C05FEA936DCDE320323B1549B19A30AC02E7DB91FDF9E3",
"date" : 586519652,
"hash" : "6A7F157E02AB0E9E134D1F48110413ABF5CA29D61824E3358AAA516D3B6CB67D",
"inLedger" : 891,
"ledger_index" : 891,
"meta" : {
"AffectedNodes" : [
{
"ModifiedNode" : {
"FinalFields" : {
"Account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"Balance" : "99999999999999990",
"Flags" : 65536,
"OwnerCount" : 0,
"RegularKey" : "rac2ReJMqmtpUAysDiNnxurmEY6iwVns82",
"Sequence" : 2
},
"LedgerEntryType" : "AccountRoot",
"LedgerIndex" : "2B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8",
"PreviousFields" : {
"Balance" : "100000000000000000",
"Flags" : 0,
"Sequence" : 1
}
}
}
],
"TransactionIndex" : 0,
"TransactionResult" : "tesSUCCESS"
},
"status" : "success",
"validated" : true
}
}
[tom@node ripple]$

在一个较晚加入私链网络的节点test中查看当前已完成的总账数据库编号范围

[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 06:59:33.065045846 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "86363-140471",
[tom@test ~]$

查询交易详情,提示无法找到交易

[tom@test ~]$ rippled tx 6A7F157E02AB0E9E134D1F48110413ABF5CA29D61824E3358AAA516D3B6CB67D --conf /usr/local/ripple/etc/rippled.cfg
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 07:00:39.579715595 HTTPClient:NFO Connecting to 127.0.0.1:8008

{
"result" : {
"error" : "txnNotFound",
"error_code" : 29,
"error_message" : "Transaction not found.",
"request" : {
"command" : "tx",
"transaction" : "6A7F157E02AB0E9E134D1F48110413ABF5CA29D61824E3358AAA516D3B6CB67D"
},
"status" : "error"
}
}
[tom@test ~]$

查询交易所在账本信息,提示未找到该账本

[tom@test ~]$ rippled ledger 891 --conf /usr/local/ripple/etc/rippled.cfg 
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 07:00:44.318081015 HTTPClient:NFO Connecting to 127.0.0.1:8008

{
"result" : {
"error" : "lgrNotFound",
"error_code" : 21,
"error_message" : "ledgerNotFound",
"request" : {
"command" : "ledger",
"ledger_index" : 891
},
"status" : "error"
}
}
[tom@test ~]$

启用总账历史维护配置并重新启动节点服务

[ledger_history]
full

启用总账历史维护配置后,当前节点已完成账本complete_ledgers编号范围向两端扩大

[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete 
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 07:11:30.943085415 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "77754-140710",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 07:23:47.692259040 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "68996-140955",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 07:46:40.158108447 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "52277-141412",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete 
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 07:59:33.520702510 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "43083-141669",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 08:08:41.423772524 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "36331-141852",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 08:43:18.161251559 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "32570-142543",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 08:43:43.923573899 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "32570-142552",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 08:43:46.535821957 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "32570-142553",
[tom@test ~]$

在不指定earliest_seq时,默认的已完成总账complete_ledgers最低值为32570,在私链上需指定该参数以包括该编号之前的历史总账。

[node_db]
type=NuDB
path=/usr/local/ripple/db/nudb
advisory_delete=0
earliest_seq=1

已完成总账同步状态

[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 08:54:03.283201753 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "27899-142758",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 09:09:17.659041802 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "16748-143063",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 09:31:28.145139033 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "645-143506",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 09:32:43.897708626 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "7-143531",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 09:32:47.002578477 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "7-143532",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 09:32:48.851592760 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "7-143533",
[tom@test ~]$ rippled server_info --conf /usr/local/ripple/etc/rippled.cfg |grep complete
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 09:32:50.681739140 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "7-143533",
[tom@test ~]$

当前私链对端节点已完成总账的状态信息

[tom@test ~]$ rippled peers --conf /usr/local/ripple/etc/rippled.cfg |grep complete_ledgers
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 09:33:20.473793774 HTTPClient:NFO Connecting to 127.0.0.1:8008

"complete_ledgers" : "11 - 143543",
"complete_ledgers" : "141543 - 143543",
"complete_ledgers" : "8 - 143543",
"complete_ledgers" : "141543 - 143543",
"complete_ledgers" : "9 - 143543",
"complete_ledgers" : "141543 - 143543",
"complete_ledgers" : "141543 - 143543",
"complete_ledgers" : "141543 - 143543",
"complete_ledgers" : "10 - 143543",
"complete_ledgers" : "141542 - 143542",
"complete_ledgers" : "141543 - 143543",
"complete_ledgers" : "141543 - 143543",
[tom@test ~]$

历史总账同步后查询交易所在总账信息

[tom@test ~]$ rippled ledger 891 --conf /usr/local/ripple/etc/rippled.cfg
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 09:34:04.257744351 HTTPClient:NFO Connecting to 127.0.0.1:8008

{
"result" : {
"ledger" : {
"accepted" : true,
"account_hash" : "DDF8DFF58D91375576EA026F01F50E3AE9B829440420878AF2D6282A6466287E",
"close_flags" : 0,
"close_time" : 586519652,
"close_time_human" : "2018-Aug-02 10:07:32.000000000",
"close_time_resolution" : 10,
"closed" : true,
"hash" : "EB702434D82270AFB4AFD952E5829C2741A40178CD0CD8ACBE53554031CE62FA",
"ledger_hash" : "EB702434D82270AFB4AFD952E5829C2741A40178CD0CD8ACBE53554031CE62FA",
"ledger_index" : "891",
"parent_close_time" : 586519651,
"parent_hash" : "0C38EB1DD432DBE4ED888C5AC9E21A12DB4770C25885BA35E7C42CA461B7FE1B",
"seqNum" : "891",
"totalCoins" : "99999999999999990",
"total_coins" : "99999999999999990",
"transaction_hash" : "D3DB2B4E309220CA89EB9521617F2314869519A7280C7747BD7585CF184922A3"
},
"ledger_hash" : "EB702434D82270AFB4AFD952E5829C2741A40178CD0CD8ACBE53554031CE62FA",
"ledger_index" : 891,
"status" : "success",
"validated" : true
}
}

历史总账同步后查询交易详情

[tom@test ~]$ rippled tx 6A7F157E02AB0E9E134D1F48110413ABF5CA29D61824E3358AAA516D3B6CB67D --conf /usr/local/ripple/etc/rippled.cfg
Loading: "/usr/local/ripple/etc/rippled.cfg"
2018-Aug-07 09:34:12.003683590 HTTPClient:NFO Connecting to 127.0.0.1:8008

{
"result" : {
"Account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"Fee" : "10",
"Flags" : 2147483648,
"RegularKey" : "rac2ReJMqmtpUAysDiNnxurmEY6iwVns82",
"Sequence" : 1,
"SigningPubKey" : "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
"TransactionType" : "SetRegularKey",
"TxnSignature" : "30440220011A56103E3FCFD990879A9E7BE30F9FF3DA618227772C23513D97FCF7E9FBF502201C2A15D155F73615B3C05FEA936DCDE320323B1549B19A30AC02E7DB91FDF9E3",
"date" : 586519652,
"hash" : "6A7F157E02AB0E9E134D1F48110413ABF5CA29D61824E3358AAA516D3B6CB67D",
"inLedger" : 891,
"ledger_index" : 891,
"meta" : {
"AffectedNodes" : [
{
"ModifiedNode" : {
"FinalFields" : {
"Account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"Balance" : "99999999999999990",
"Flags" : 65536,
"OwnerCount" : 0,
"RegularKey" : "rac2ReJMqmtpUAysDiNnxurmEY6iwVns82",
"Sequence" : 2
},
"LedgerEntryType" : "AccountRoot",
"LedgerIndex" : "2B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8",
"PreviousFields" : {
"Balance" : "100000000000000000",
"Flags" : 0,
"Sequence" : 1
}
}
}
],
"TransactionIndex" : 0,
"TransactionResult" : "tesSUCCESS"
},
"status" : "success",
"validated" : true
}
}
[tom@test ~]$

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据