Better audit trail in wallet.log
The wallet should write a log entry every time money is spent. To make this more useful, SendSiacoins
and SendSiafunds
(as well as the transaction builder) should be extended with a context
parameter. It would look something like this:
func (api *API) walletSiacoinsHandler(w http.ResponseWriter, req *http.Request) {
ctx := fmt.Sprintf("/wallet/siacoins call initiated by %v", req.RemoteAddr())
txns, err := api.wallet.SendSiacoins(amount, dest, ctx)
}
func (c *Contractor) managedNewContract(host modules.HostDBEntry) {
ctx := fmt.Sprintf("forming file contract with host %v", host.PublicKey)
txnBuilder := c.wallet.StartTransaction(ctx)
contract, err := proto.FormContract(params, txnBuilder, c.tpool)
}
Resulting in these log entries:
2017/03/17 01:58:17.279859 audit.go:27: INFO: Sending 100SC to abcdef12345
Reason: /wallet/siacoins call initiated by localhost:9001
2017/03/17 02:48:17.429551 audit.go:27: INFO: Sending 2000SC to fedcba54321
Reason: forming file contract with host ed25519:deadbeef314159
This should help people understand where their money is going, and should be particularly useful for people who believe their coins may have been stolen.