原始文献 / 论坛帖 / Re: [PATCH] implement 'listtransactions'

Re: [PATCH] implement 'listtransactions'

Bitcointalk · 2010-07-30 19:40:54 UTC

AuthorSatoshi Nakamoto
TitleRe: [PATCH] implement 'listtransactions'
Date2010-07-30 19:40:54 UTC
ForumBitcointalk · 原文

你需要用 listtransactions 来做什么?

我不实现 listtransactions 的原因是,我要确保网页程序员不会用它。用它来监控收款太容易让人上瘾了。那样做没有可靠的办法保证万无一失。在我们有成熟的示例代码,用 getreceivedbyaddress 和 getreceivedbylabel 指着说"用这个!用这个!别用 listtransactions!"之前,我认为不该实现 listtransactions。

等我们实现 listtransactions 时,对付这个问题的办法之一是让它只输出纯文本。它不应把字段拆成 comment、confirmations、credit、debit 之类。可以是一整串格式化好的字符串,比如 "0/unconfirmed 0:0:0 date comment debit 4 credit 0" 之类的,这样程序员就很难拿它去做错误的处理。它只用来查看服务器状态。我猜这对想把它排成 HTML 表格的网页界面来说会有点烦,不过也没办法。

英文原文

What are you needing to use listtransactions for?

The reason I didn't implement listtransactions is I want to make sure web programmers don't use it. It would be very easy to latch onto that for watching for received payments. There is no reliable way to do it that way and make sure nothing can slip through the cracks. Until we have solid example code using getreceivedbyaddress and getreceivedbylabel to point to and say "use this! use this! don't use listtransactions!", I don't think we should implement listtransactions.

When we do implement listtransactions, maybe one way to fight that is to make it all text. It should not break down the fields into e.g. comment, confirmations, credit, debit. It could be one pretty formatted string like "0/unconfirmed 0:0:0 date comment debit 4 credit 0" or something so it's hard for programmers to do the wrong thing and process it. It's only for viewing the status of your server. I guess that would be kinda annoying for web interfaces that would rather format it into html columns though.