Bitcointalk · [PATCH] implement 'xlisttransactions'

中本聪,2010 年 7 月 30 日

SN-1713 已核对来源,附原文与上下文。

阅读语言
中文译文

你需要用 listtransactions 做什么?

我当初不实现 listtransactions,就是想确保 web 程序员不会用它。人们很容易顺手拿它来盯收到的付款。走那条路没有任何可靠的办法保证什么都不漏。在拿出过硬的示例代码、用 getreceivedbyaddress 和 getreceivedbylabel 指着说「用这个!用这个!别用 listtransactions!」之前,我认为不应该实现 listtransactions。

真要实现的时候,兴许一个对抗滥用的办法是把它做成纯文本。不要把字段拆成 comment、confirmations、credit、debit 之类。可以是一个格式化好的字符串,譬如 "0/unconfirmed 0:0:0 date comment debit 4 credit 0" 什么的,让程序员难以做错事、去解析它。它只是用来看服务器状态的。不过我猜这对想把内容格式化成 html 表格的 web 界面来说会有点烦。

ORIGINAL · 英文原文
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.
上下文
← 上一条 SN-1713 · 当前 下一条 → 在档案中查看完整主题串 →
来源
Bitcointalk 原始链接 ↗ 记录编号 SN-1713