Feed timestamps not monotonically increasing

I was having a problem getting Broadcasts to relay through counterpartyd, and was getting this error message. Any idea what it’s about? Here’s the response I’m getting from the server:

{"jsonrpc"=>"2.0", "id"=>"0", "error"=>{"message"=>"Server error", "code"=>-32000, "data"=>{"message"=>"['feed timestamps not monotonically increasing']", "type"=>"ComposeError", "args"=>[["feed timestamps not monotonically increasing"]]}}}

And here’s what I’m seeng in my logs on my issue:

2015-04-08-T17:07:06+0000 [ERROR] API Exception: {'type': 'ComposeError', 'args': (['feed timestamps not monotonically increasing'],), 'message': "['feed timestamps not monotonically increasing']"}                                         
Traceback (most recent call last):                                                                                     
 File "/home/xcp/federatednode_build/env/lib/python3.4/site-packages/jsonrpc/manager.py", line 108, in _get_responses 
   result = method(*request.args, **request.kwargs)                                                                   
 File "/home/xcp/federatednode_build/env/lib/python3.4/site-packages/counterpartylib/lib/api.py", line 426, in create_method                                                                                                                 
   return compose_transaction(db, name=tx, params=transaction_args, **common_args)                                    
 File "/home/xcp/federatednode_build/env/lib/python3.4/site-packages/counterpartylib/lib/api.py", line 281, in compose_transaction                                                                                                           
   tx_info = compose_method(db, **params)                                                                             
 File "/home/xcp/federatednode_build/env/lib/python3.4/site-packages/counterpartylib/lib/messages/broadcast.py", line 103, in compose                                                                                                        
   if problems: raise exceptions.ComposeError(problems)                                                               
counterpartylib.lib.exceptions.ComposeError: ['feed timestamps not monotonically increasing']

Ahh, I figured it out. My timestamp was too far in the past. Stupid me! Poorly written spec was off. I hadn’t noticed this prior, as I wasn’t re-using addresses. Notice the timestamp parameter below.

Before:

Counterparty::Broadcast.new source: source_address, fee_fraction: 0.05, text: "Price of gold, 12AM UTC March1. 1=inc 2=dec/const", value: 2.0, timestamp: 1418926641, allow_unconfirmed_inputs: true

After:

Counterparty::Broadcast.new source: source_address, fee_fraction: 0.05, text: "Price of gold, 12AM UTC March1. 1=inc 2=dec/const", value: 2.0, timestamp: Time.now.to_i, allow_unconfirmed_inputs: true

This occurs when there is a previous broadcast from the same address, and you try to enter a new broadcast with a timestamp less than or equal to the last timestamp. Here is the logic in the Counterparty source code:

    if broadcasts:
    last_broadcast = broadcasts[-1]
    if last_broadcast['locked']:
        problems.append('locked feed')
    elif timestamp <= last_broadcast['timestamp']:
        problems.append('feed timestamps not monotonically increasing')