anchor.diff:      store(ChId, NewF).
   hashlock(ChId, Amount, SecretHash) ->
       F = read(ChId),
  -    io:fwrite("channel manager "),
  -    io:fwrite(packer:pack(F)),
       Ch = sign:data(F#f.channel),
       Ch2 = channel_block_tx:update(Ch, Amount div 2, 1),
       Channel = block_tree:channel(ChId),
  
positive.code:     true = channel_block_tx:is_cb(NewCh),
      F = read(ChId),
      Ch = sign:data(F#f.channel),
      io:fwrite("\nABC"),
      io:fwrite("old ch "),
      io:fwrite(packer:pack(Ch)),
      io:fwrite("\n"),
      io:fwrite("new ch from partner"),
      io:fwrite(packer:pack(NewCh)),
      NewAmount = channel_block_tx:amount(NewCh),
      OldAmount = channel_block_tx:amount(Ch),
      NewN = channel_block_tx:nonce(NewCh),
  
negative.code:     end,
      SecretHash = language:extract_sh(channel_block_tx:bet_code(hd(channel_block_tx:bets(NewCh)))),
      Script = language:hashlock(ToAmount, SecretHash),
      NewCha = channel_block_tx:add_bet(Ch2, A, Script),%this ensures that they didn't adjust anything else in the channel besides the amount and nonce and bet.
      NewCh = NewCha,
      NewF = #f{channel = SignedChannel, unlock = F#f.unlock},
      store(ChId, NewF),
      keys:sign(NewCh).
  
  recieve(ChId, MinAmount, SignedPayment) ->
      %we need to verify that the other party signed it.
      ID = keys:id(),
      Payment = sign:data(SignedPayment),
  